deleting types

BlitzMax Forums/BlitzMax Programming/deleting types

Example of objects being deleted:

Type TSomeType
	Global TypeList:TList
	
	Global Count:Int
	
	Field Param:Int
	
	Method New()
		If TypeList = Null Then TypeList = New TList
		ListAddLast(TypeList,Self)
		Count :+ 1
	End Method
	
	Method Delete()
		Count :- 1
	End Method
	
	Function Create:TSomeType(Param:Int)
		Local tst:TSomeType = New TSomeType
		tst.Param = Param
		Return tst
	End Function
	
	Function Update()
		For Local tst:TSomeType = EachIn TSomeType.TypeList
			TSomeType.TypeList.Remove(tst)
			FlushMem
			Print "Number of objects: "+TSomeType.TypeList.Count()
		Next
	End Function
End Type


For Local i:Int = 0 To 10
	TSomeType.Create(i)
Next

TSomeType.Update()