Up: Member Keywords


3.1 Access Modifiers

Access modifiers, when provided in keywords, alter the interface into which the definition of member name is placed. There are three interfaces, or levels of visibility, that dictate the context from which a member may be accessed, listed here from the most permissive to the least:

public
Accessible outside of C or any instance of C (e.g. ‘foo.publicProp’). Inherited by subtypes of C.
protected
Not accessible outside of C or an instance of C (e.g. ‘this.protectedProp’ within context of C). Inherited by subtypes of C.
private
Not accessible outside of C or any instance of C. Not inherited by subtypes of C.

Keyword Description
public Places member name in public interface (accessible outside of C or instance of C; accessible by subtypes). Implied if no other access modifier is provided.
protected Places member name in protected interface (accessible only within C or instance of C; accessible by subtypes).
private Places member name in private interface (accessible only within C or instance of C; not accessible by subtypes).

Table 3.2: Access modifiers

Access modifiers have the following properties: