1 The visibility of the base class member to the derived class
1. Communal inheritance (public): When a public member of a base class and a protected member are members of a derived class, they remain in their original state, and the private members of the base class are still private and cannot be accessed by subclasses of this derived class.
2. Private inheritance: The public and protected members of the base class are both private members of the derived class and cannot be accessed by subclasses of this derived class.
3. Protection Inheritance (Protected): All public and protected members of the base class are protected members of the derived class and can only be accessed by its derived class member functions or friends, and the private members of the base class are still private.
The following lists the base class attributes and derived class attributes for three different inheritance methods.
Table One: The visibility of a base class member to a derived class
Public protected private
Public Inheritance visible Invisible
Private Inheritance visible Invisible
Protect inheritance visible visible not visible
2 The visibility of the base class member to the derived class object
Table Two: The visibility of base class members to derived class objects
public protected &N Bsp;private
& nbsp Public inheritance visible not visible not visible &NBS P &NB Sp  &NBS P
Private inheritance cannot be seen or visible
Protected inheritance Invisible invisible
In public inheritance, the objects of the derived class can access public members in the base class, and the member functions of the derived class can access public and protected members in the base class.
In private inheritance, a member of a base class can only be accessed by a direct derived class and cannot be inherited further down.
The aforementioned visibility is accessibility. The object of the derived class is called horizontal access to the base class, and the derived class of the derived class accesses the base class for vertical access.
In the case of public inheritance, horizontal and vertical access is unrestricted for public members in the base class;
When private inheritance, horizontal and vertical access is not accessible to public members in the base class;
When you protect inheritance, for vertical access same as public inheritance, for horizontal access to private inheritance.
A private member in a base class can only be accessed by member functions and friend functions in the base class, and not by other functions.
Public, private, and protected inheritance can access the protection variables of the parent class through the function, but not the private variables of the parent class.