Accessing private fields in a data class method |
Category: |
RPL
Applicable to: |
All Versions
Description: |
The field name (or instance variable) is visible within the scope of an instance of the class. See page 7 of the RPL guide.
For example if you have a Sequence class "MySequence", containing a field "myField" which was private, then you could define a unary instance method "getMyField" on that class to read it:
getMyField | | ^ myField
and and a keyword method "storeMyField: aValue" to write to it:
storeMyField: aValue | | myField := aValue. ^ myField.
Limitations: |
None
Copyright © 1999, ObjecTime Limited. |