1. First of all, say the member function of the class or the 3 properties of the member variable:
public : for objects and member functions are visible, that is, you can reference the
protected: for member functions that are visible, but invisible to objects, this declaration is mainly used in inheritance, which is discussed below
Private: is visible for member functions, invisible to objects
2, and then look at the way of inheritance:
Base class member keywords derived class inheritance methods derived class member access permissions for base classes
public public is equivalent to using the Public keyword
protected is equivalent to using the procted keyword
private is equivalent to using the Private keyword
protected protected is equivalent to using the procted keyword
protected is equivalent to using the procted keyword
private is equivalent to using the Private keyword
Private public is equivalent to using the Private keyword
Protected equivalent to using the Private keyword
Private is equivalent to using the Private keyword
There are a few to note: the private members of the base class are not only invisible to the object, but also invisible to the derived class, and can only be accessed by a base class member or friend; the procted member is actually private to the object, except when it is inherited and private. Derived class members can access procted members of the base class; protected and private inheritance are rarely used in actual programming, and are mainly used in theoretical analysis.
PS: The object in this case is actually a variable declared by the class, the class defined inside the class is a private member of the class that can access it, and the variables defined within the class can also access the private members of the class;