OOP question

BlitzMax Forums/BlitzMax Beginners Area/OOP 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.

One advantage I can see to OOP is you can make everything a derivitive of a base class, in this case "tEngineNode". If your player class then has a "target" value of another entity, you can supply it with any kind of type, since they are all derivitives of the tEngineNode. However, when I try this, I am unable to recover the "speed" value.

Type tEngineNode
EndType

Type tPlayer Extends tEngineNode
	Field target:tenginenode
EndType

Type tVehicle Extends tEngineNode
	Field speed#=100
	Field target:tenginenode
EndType

player:tplayer=New tplayer
vehicle:tvehicle=New tvehicle

player.target=vehicle
Notify player.target.speed