Protected Inheritance in C++
Understanding the concept of Protected Inheritance in C++. A special mention of visibility label protected: We have just seen how to increase the capabilities of an existing class without modifying it. We have also seen that a private member of a base class cannot be inherited and therefore its is not available for the derived class directly. What do we do if the private data needs to be inherited by a derived class? This can be accomplished by modifying the visibility limit of the private member by making it public. But, this would make it accessible to all the other functions of the program, thus, eliminating the advantage of data hiding. C++ provides a third visibility modifier, protected which serves a limited purpose in inheritance. A member declared as protected is accessible by the member functions within its class and any class immediately derived from it. It cannot be accessed...