Releasing an object from its own method?

BlitzMax Forums/BlitzMax Beginners Area/Releasing an object from its own method?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here is how I explained it to a friend.

Type Balloon

Method New()
Print "A balloon was created"
End Method

Method Delete()
Print "The balloon flown away"
End Method

End Type

Print ""
Print "Creating the balloon and get a reference handle to it"
Local BalloonString1:Balloon = New Balloon
Print ""

Print "Creating a second reference handle that connects to whatever BalloonString1 are connected to."
Local BalloonString2:Balloon = BalloonString1
Print ""

Print "Releasing the first handle"
BalloonString1 = Null ' "Cut" the first string
Print "Flush away all nonreferenced objects"
FlushMem()
Print ""

Print "Releasing the second handle"
BalloonString2 = Null ' "Cut" the second string
Print "Flush away all nonreferenced objects"
FlushMem()
Print ""