Creation methods?

BlitzMax Forums/BlitzMax Programming/Creation methods?

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.

just another sample:


Strict

Type TBOX
Field Mass:Float,Size:Float
Field name:String
Method rename(newname:String)
	Print "renaming "+name+" to "+newname
	name = newname	
End Method

  Function Create:TBOX( Mass:Float=1.0, Size:Float=2.0, name:String="New Box")
    Local temp:TBOX = New TBOX
      temp.Mass = Mass
      temp.Size = Size
      Temp.name = name
    Return temp
  End Function
End Type

Local mybox:TBOX = TBOX.Create()

Print mybox.name
mybox.rename("Big Box")
Print mybox.name