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:
- Accessible outside of C or any instance of C (e.g.
‘foo.publicProp’). Inherited by subtypes of C.
- Not accessible outside of C or an instance of C (e.g.
‘this.protectedProp’ within context of C).
Inherited by subtypes of
- Not accessible outside of C or any instance of C. Not inherited by subtypes of C.
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 (but see |
Places member name in protected interface (accessible only within
C or instance of C; accessible by subtypes).
Places member name in private interface (accessible only within
C or instance of C; not accessible by subtypes); implicit if the
member name is prefixed with an underscore, unless another access modifier
is explicitly provided.
Table 3.2: Access modifiers
Access modifiers have the following properties:
- Only one access modifier may appear in keywords for any given name.
- If no access modifier is provided in keywords for any member
name, member name is implicitly
public, unless the member name is prefixed with an underscore, in which case it is implicitly