When a subclass inherits a parent class, it can inherit the parent class in public, private, and protected ways, each of which differs in the following ways:
1) Public inheritance mode
All public members in the base class are public properties in the derived class;
All protected members in the base class are protected properties in the derived class;
All private members in the base class are not accessible in the derived class.
2) Protected Inheritance Way
All public members in the base class are protected properties in the derived class;
All protected members in the base class are protected properties in the derived class;
All private members in the base class are still inaccessible in the derived class.
3 Private Inheritance Mode
All public members in the base class are private properties in the derived class;
All protected members in the base class are private in the derived class;
All private members in the base class are not accessible in the derived class.