Object question

BlitzMax Forums/BlitzMax Beginners Area/Object question

That's because your array is full of type Object and not type Tb. Since .update is not a method of type Object then it won't work. You need to typecast the call like so:
Tb(objectarray[t]).update
If you wish to be able to use a multiple of different types, then you need to create a base type with abstract methods and extend that.
Type TBase
	Global index:Int
	Method New()
		index:+1
	End Method
	
	Method update() Abstract
End Type

Type Ta
	Field objectarray:TBase[]
	Field maxobjects:Int
	
	Method Add(e:TBase)
		maxobjects:+1
		objectarray=objectarray[..maxobjects]
		objectarray[maxobjects-1]=e ' <- add e:Object to array
	End Method
	
	Method run()
		For Local t:Int=0 To maxobjects-1
			objectarray[t].update ' <- assuming this update is the update method from Tb
		Next
	End Method
End Type

Type Tb Extends TBase
	Field Typeindex:Int
	
	Method New()
		Typeindex = index
	End Method
	
	Method update()
		Print "yay \o/ "+Typeindex
	End Method
End Type

Type Tc Extends TBase
	Field Typeindex:Int
	
	Method New()
		Typeindex = index
	End Method
	
	Method update()
		Print "yipeee!!!! "+Typeindex
	End Method
End Type


Local a:Ta=New Ta

a.Add New Tb
a.Add New Tb
a.Add New Tc
a.Add New Tc

a.Run

End