readOnly
, stopping them from being modified by the end user, or writeOnce
allowing them to be set by the end user, but only once. This example demonstrates how to setup attributes for your class as readOnly
or writeOnce
attributes, and shows how their behavior differs when the end user attempts to set their values.
Construct o1, setting initial values for both foo and bar in the constructor:
Try setting values again, after they've been set once:
Call a MyClass method, which sets foo internally (using _set):