plee for Properties, Private Fields

BlitzMax Forums/BlitzMax Programming/plee for Properties, Private Fields

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.

General idea for properties

i.Speed = 50

If Speed is not a field of i Then
  If i has method SetSpeed Then
    i.SetSpeed( 50 )
  Else
    Throw exception
  EndIf
EndIf

Print i.Speed

If Speed is not a field of i Then
  If i has method GetSpeed Then
    Return i.GetSpeed
  Else
    Throw exception
  EndIf
EndIf


This is exactly how D does it. It's a very simple implementation of properties and works flawlessly. I don't see why it couldn't be added as syntactic sugar for BlitzMax.