Deleting types

Blitz3D Forums/Blitz3D Programming/Deleting types

Moraldi(Posted 2006) [#1]
Hi again,
I have the following type
MyType

  field A.TypeA
  field B.TypeB

end type

global AnInstance MyType
.
.
.

When I want to delete the AnInstance variable do I have to delete manually the A and B or not?
Function MyTypeDelete(v.MyType)

  delete v

end function

or
Function MyTypeDelete(v.MyType)

  delete v\A
  delete v\B
  delete v

end function


thanks


Curtastic(Posted 2006) [#2]
"Delete v" will not delete v\A.
v\A is not inside v, it is just a pointer. The instance that v\A points to still exists in the TypeA list.

It's like: if you do "v\A=Null" it won't delete v\A.


Stevie G(Posted 2006) [#3]
Yip, use option 2.

Stevie


Moraldi(Posted 2006) [#4]
Thanks!