access modifier in C++

<b>Member-Access Control</b>
The default access is private in a class, and public in a struct or union (Yes, union can have access modifier in C++). 
Access specifiers in a class can be used any number of times in any order.
Access control is equally applicable to all names: member functions, member data, nested classes, and enumerators.
Type of Access | Meaning
----- | -----
private | Class members declared as private can be used only by member functions and friends (classes or functions) of the class.
protected | Class members declared as protected can be used by member functions and friends (classes or functions) of the class. Additionally, they can be used by classes derived from the class.
public | Class members declared as public can be used by any function.

<b>Access Control in Derived Classes</b>
Two factors control which members of a base class are accessible in a derived class; these same factors control access to the inherited members in the derived class:
* Whether the derived class declares the base class using the public access specifier.
* What the access to the member is in the base class.

| private | protected | public
| ----- | ----- | -----
| Always inaccessible with any derivation access | private in derived class if you use private derivation | private in derived class if you use private derivation
|    | protected in derived class if you use protected derivation | protected in derived class if you use protected derivation
|    | protected in derived class if you use public derivation | public in derived class if you use public derivation