DekGenius.com
Team LiB   Previous Section   Next Section
public access specifier No restrictions on member access

access-specifier := public

The public keyword can be used within a class definition (followed by a colon) to mark subsequent member declarations as public or before a base-class name in the class header to mark the inheritance as public. The default access level of a struct is public, both for members and base classes.

Public members can be used freely by any other class or function.

Public inheritance means all members of the base class retain their accessibility levels.

See private for an example.

See Also

class, private, protected, struct, Chapter 6

    Team LiB   Previous Section   Next Section