At compile time, a strict notion of protection and encapsulation is maintained. At runtime however, enough facilities exist to effectively void any protection. (This is intentional as it allows for very flexible dynamic behaviour.)
All methods and object variables are associated with a protection level.
protection_qualifier: `private' | `protected' | `public' ;
The protection level defines availability on a class basis; it does not discern between different extensions of the class. Given that an extension can be defined in a unit different from the main extension, protection is not hampered by unit boundaries. (This is intentional.)
private
protected
public
An object variable declared public
is not actually directly
accessible from outside the current class (see section Accessibility), but
causes an accessor method to be defined for it. If the variable is
declared to be mutable
, usually in addition to the variable being
public
, a modifier method is defined for it.
For a public mutable int foo_bar
, the following two methods
are defined:
/* Accessor. */ int foo_bar { = foo_bar; } /* Modifier. */ void set_foo_bar int value { foo_bar = value; }
Go to the first, previous, next, last section, table of contents.