next up previous contents index
Next: Classes Up: Objects Previous: Method invocation

Visibility

For objects, only 2 visibility specifiers exist : private and public. If you don't specify a visibility specifier, public is assumed.

Both methods and fields can be hidden from a programmer by putting them in a private section. The exact visibility rule is as follows:

Private
All fields and methods that are in a private block, can only be accessed in the module (i.e. unit or program) that contains the object definition. They can be accessed from inside the object's methods or from outside them e.g. from other objects' methods, or global functions.
Public
sections are always accessible, from everywhere. Fields and metods in a public section behave as though they were part of an ordinary record type.


next up previous contents index
Next: Classes Up: Objects Previous: Method invocation

Michael Van Canneyt
Fri Sep 25 09:15:40 MEST 1998