How to store reference of an object in an array?

BlitzMax Forums/BlitzMax Beginners Area/How to store reference of an object in an array?

Rick_72(Posted 2010) [#1]
Could you help me with this issue, please:

Global myArray:TLink[10]

Type myType1
	Field x:Int
End Type

Type myType2
	Field x:Int
End Type


my1:myType1 = New myType1
my2:myType2 = New myType2

myArray[1] = ??? reference To my1 ???
myArray[2] = ??? reference To my2 ???


I need to store a reference to different objects in a TLink-Array (the objects differ, so array:myType is not possible). Is this possible somehow?


Brucey(Posted 2010) [#2]
How about :
Global myArray:Object[10]


or..

Global myArray:BaseType[10]

Type BaseType
End Type

Type myType1 Extends BaseType
	Field x:Int
End Type

Type myType2 Extends BaseType
	Field x:Int
End Type


?


Rick_72(Posted 2010) [#3]
Yes, thanks Brucey! That's it.