For objects, three visibility specifiers exist: private, protected and public. If a visibility
specifier is not specified, 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
- 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.
- Is the same as Private, except that the members of a Protected section are
also accessible to descendent types, even if they are implemented in other modules.
- fields and methods are always accessible, from everywhere. Fields and methods in
a public section behave as though they were part of an ordinary record type.