Visibility Scope

Declarations of members enable control over member access. The member visibility is established by the access level specified in its declaration combined with the access level of the containing type, if any. An access modifier is used to specify access level:

Access modifier Description Elements that can be declared using this modifier Declaration context where a modifier can be used
Public Public access level. Member access is not limited.

classes, interfaces, enumerations, structures, delegates

constants, variables, procedures and functions, properties, events

class, namespace, structure
Private Private access level. Member access is limited to the containing class.

constants, variables, procedures and functions, properties, events

class, structure
Protected Protected access level. Member access is limited to the containing class or types derived from the containing class.

constants, variables, procedures and functions, properties, events

class
Friend Assembly access level. Member access is limited to the assembly (program) in which it is declared.

classes, interfaces, enumerations, structures, delegates, events

constants, variables, procedures and functions, properties

class, namespace, structure
Protected Friend Protected assembly access level Member access is limited either to the current assembly or to the classes derived from the class containing this member, or to both conditions being satisfied.

constants, variables, procedures and functions, properties, events

class

Depending on the context, in which a member declaration takes place, only certain access modifiers are permitted. When a member declaration does not include any access modifiers, its visibility is determined by the default declared accessibility.

Member Visibility Constraints

Specific structures in the language require a type to be at least as accessible as a member or another type.

There are the following constraints:

See also:

Fore.NET Language Guide