OOP Guidelines

BlitzMax Forums/BlitzMax Tutorials/OOP Guidelines

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.

Type Vector
 Field X#=67,Y#=54
End Type

Type SpaceObject Abstract
 Field Location:vector= New Vector  'Strictly not a vector, but hey
 Field Speed:Vector= New Vector

 Method Update()
  Location.X:+Speed.X
  Location.Y:+Speed.Y
  Print location.x
  Print location.y
 EndMethod
End Type

Type Ship Extends SpaceObject Abstract 'Ship is a type of space object
 Field StartHealth#=0, StartArmor#=0


 Field Health#, Armor#
End Type

Type Cruiser Extends Ship 'Cruiser is a type of ship
 Field StartHealth#=200, StartArmor#=20
End Type

a:Cruiser=New Cruiser

a.Update()



just incase anybody problems with the last method you have to add the New ect Command aswell