You can dereference it, and then it will die at the next flushmem
Type A
Field x:int
Method Check()
if (x<0) Then
MyObject = Null
Return
endIf
End Method
End Type
MyObject:A = New A
While (Not Keydown (KEY_ESCAPE))
If Not MyObject = Null then MyObject.Check()
flushMem
Wend
It usualy has no sense to check for a single instance of an object inside the object itself. Anyway, the object can remove itself from a List or collection if it's contained there. If there are not more instances of the object, it will die when it's dereferenced from the List or collection. In my honest opinion, objects shouldn't be referenced twice. It's always a sign of poor design.
|