Tlists containing different types

BlitzMax Forums/BlitzMax Programming/Tlists containing different types

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.

The Ohter way is to use Polymorphism:
Type tTestBase
	Field Name:String
EndType

Type tTestA Extends tTestBase
	Method New()
		name = "TESTA"
	EndMethod
End Type

Type tTestB Extends tTestBase
	Method New()
		name = "TESTB"
	EndMethod
End Type


Global Test:TList=New TList

Test.addlast (New tTestA)
Test.addlast (New tTestB)
Test.addlast (New tTestB)
Test.addlast (New tTestA)
Test.addlast (New tTestB)


For Local loop:tTestBase = EachIn Test			   
	Print loop.name							'common field for both types
Next