Object question

BlitzMax Forums/BlitzMax Beginners Area/Object question

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.

ok, perhaps a n00b question, but therefor I breathe. Why won't this code work? I expect to be able to put any instance of any type into an array, upon which I will be able to update each instance from within the Ta array. I intend to have update methods in each and every object I add to this list.

Type Ta
	Field objectarray:Object[]
	Field maxobjects:Int
	
	Method Add(e:Object)
		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
	Global index:Int
	
	Method New()
		index:+1
	End Method
	
	Method update()
		Print "yay \o/ "+index
	End Method
End Type


Local a:Ta=New Ta

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

a.Run

End