Visibility Sections

For almost all members of a class or record, visibility – that is, which portions of your code have access to that member – is defined by the visibility section that the member is declared in.

By default types start with a visibility level of private after the class or record keyword, and if no other level is specified, all members have that visibility.The following keywords and keyword combinations can be used to introduce a new visibility section that all subsequent members will fall into.

Name Scope Value
private Members Only accessible from other members of this same type
unit Members & Types Only accessible from within the same file
unit or protected Members Only accessible from this type, a subclass or within the same file
unit and protected Members Only accessible from this type, a subclass that is within the same file
assembly Members & Types Only accessible from within this project
assembly or protected Members Only accessible from this type, a subclass or within the same assembly
assembly and protected Members Only accessible from this type, a subclass that is within the same assembly
protected Members Only accessible from this type or subclasses
public Members & Types Accessible from everywhere

The unit, assembly and public visibility levels are also available for types themselves.