RosettaCodeData/Task/Classes/PureBasic/classes-2.basic

31 lines
520 B
Plaintext

Class Foo
Private Value.i
BeginPublic
Method Init()
; Any needed code goes here
EndMethod
Method Release()
; Any code befoe freeing the object goes here
EndMethod
Method Get()
MethodReturn This\Value
EndMethod
Method Set(n)
This\Value = n
EndMethod
Method.s ToString()
MethodReturn Str(This\Value)
EndMethod
EndPublic
EndClass
;- Test the code
*Demo.foo = NewObject.foo()
*Demo\Set(4)
MessageRequester("Info", "Val= " + *Demo\ToString())