Extended Types and Global Lists

BlitzMax Forums/BlitzMax Beginners Area/Extended Types and Global Lists

I've probably got completely the wrong end of the stick.

This code will list the Base Class and the extended classes.

Type A
	
	Global List:TList
	
	Field Test:Byte
	
	Method New()
		
		If List=Null
			List=New TList
		End If
		ListAddLast List,Self
		self.test = Rand(0,255)
		
	End Method
	
	
End Type


Type B Extends A
	
End Type


Type C Extends A
	
End Type


Global AB=New B
Global BB=New B
Global CB=New B

Global AC=New C
Global BC=New C
Global CC=New C

' List all types

For allTypes:A = EachIn a.List
	Print allTypes.Test
Next

Print "--------"
' List all B types

For bTypes:B = EachIn a.List
	Print bTypes.Test
Next

Print "--------"
' List all C types

For cTypes:C = EachIn a.List
	Print cTypes.Test
Next