OOAD Princhiples Q/A #3


Question:What is the difference between publicly derived inheritance and privately derived inheritance?

Answer:

Sr. No.Publicly derived inheritancePrivately derived inheritance
1The public derivation of inheritance means that the derived class can access public and protected members of the base class.The private derivation of inheritance means that the derived class can access public and protected members of the base class privately.
2The public derivation does not change the access specifiers for inherited members in the derived class. They can be inherited further.The inherited members become private in the derived class and they can not be inherited further by any other derived class derived from this derived class.
3The protected member of base class will act as a protected member in derived class.The protected members of a base class will act as a private member in derived class.
4The public member of base class will remain public member in derived class.The public members of a base class will act as a private member in derived class.
Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements