OOP... If You Don't Wanna Hear It From Me...

Miscellaneous Forums/General Discussion/OOP... If You Don't Wanna Hear It From Me...

This makes it a bit better, adding a "class" field to the tEngineNode class, so you can tell what kind of object it is:
Const CLASS_PLAYER=1
Const CLASS_VEHICLE=2

Type tEngineNode
Field target:tEngineNode
Field vehicle:tVehicle
Field player:tPlayer
Field class
EndType

Type tPlayer Extends tEngineNode
	Method New()
		player=Self
		class=CLASS_PLAYER
	EndMethod
EndType

Type tVehicle Extends tEngineNode
	Field speed#=100
	Method New()
		vehicle=Self
		class=CLASS_VEHICLE
	EndMethod
EndType

player:tplayer=New tplayer
vehicle:tvehicle=New tvehicle
player.target=vehicle

If player.target.class=CLASS_VEHICLE
	Notify player.target.vehicle.speed
EndIf


Overall, I get the feeling this will make my code less manageable. There's a reason C/C++ programmers take ten times as long to get anything done.