19 lines
477 B
Plaintext
19 lines
477 B
Plaintext
INSTALL @lib$+"CLASSLIB"
|
|
|
|
REM Declare the class:
|
|
DIM MyClass{variable, @constructor, _method}
|
|
DEF MyClass.@constructor MyClass.variable = PI : ENDPROC
|
|
DEF MyClass._method = MyClass.variable ^ 2
|
|
|
|
REM Register the class:
|
|
PROC_class(MyClass{})
|
|
|
|
REM Instantiate the class:
|
|
PROC_new(myclass{}, MyClass{})
|
|
|
|
REM Call the method:
|
|
PRINT FN(myclass._method)
|
|
|
|
REM Discard the instance:
|
|
PROC_discard(myclass{})
|