[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FreeM supports private fields with the :PRIVATE
specifier in the SET
command, enforcing classical object-oriented data encapsulation. The :PUBLIC
specifier is provided for completeness, and is the default.
The below constructor for a FRACTION
class defines two private fields:
%FRACTION(THIS,INIT):OBJECT ; S THIS("NUMERATOR"):PRIVATE=$P(INIT,"/",1) S THIS("DENOMINATOR"):PRIVATE=$P(INIT,"/",2) Q
Either of the following commands will create a public field:
S THIS("VARNAM")="Initial Value" S THIS("VARNAM"):PUBLIC="Initial Value"
Attempting to access private fields from outside of the class will raise error condition ZOBJFLDACCV
.
This document was generated on May 5, 2025 using texi2html 5.0.