access specifiers
From cppreference.com
                    
                                        
                    
                    
                                                            
                    In a class or struct body define the visibility of following declarators In a inheritance list, define the maximum visibility of inherited members
[edit] Syntax
| public: declarators | (1) | ||||||||
| protected: declarators | (2) | ||||||||
| private: declarators | (3) | ||||||||
 class identifier : public class_name
 | 
(4) | ||||||||
 class identifier : protected class_name
 | 
(5) | ||||||||
 class identifier : private class_name
 | 
(6) | ||||||||
[edit] Explanation
- The symbols declared after the specifier have public accessibility
 - The symbols declared after the specifier have protected accessibility
 - The symbols declared after the specifier have private accessibility
 - The inherited members have the same accessibility as the base class ( either protected or public as private won't be visible in the derived class )
 - The inherited members have protected accessibility in the derived class
 - The inherited members have private accessibility in the derived class
 
[edit] Member accessibility by specifier
- public
 - public members are accessible everywhere, within and outside the class scope
 - protected
 - protected members are accessible within the class and its methods and in its descendants
 - private
 - private members can be only accessed within the class and its methods
 
To grant access to external functions or classes to protected or private members, a friendship declaration must be present in the class body
Inherited private members are still present in the class data but cannot be accessed directly
A class has default private accessibility for inheritance and members, a struct has instead a default public accessibility
| This section is incomplete Reason: example  |