C++: What is the difference between protected and private inheritance?
What is the difference between protected and private inheritance?
It is a common practice to inherit a class publicly, for example,
class der : public base
{
----
} ;
What happens if a class is inherited protectedly?
class der : protected base
{
----
} ;
In such cases all public and protected member functions become protected in the derived class, whereas, private functions remain private to derived class.
When a class in inherited privately, all the public and protected member functions become private to the derived class.




Comments
Log in or create a user account to comment.