What is the difference between
public
,private
, andprotected
inheritance in C++?
The private members of a base class can only be accessed by members of that base class .
The public members of a base class can be accessed by members of that base class, members of its derived class as well as the members which are outside the base class and derived class.
The protected members of a base class can be accessed by members of base class as well as members of its derived class.
private: base
protected: base + derived
public: base + derived + any other member