a When you derive a base class using protected access specifier, the private members of the base class become protected members of the derived class (the private members of the base class are not available to the derived class). Protected inheritance is a good technique to use when you derive a class based on a class that was not written for inheritance because it converts public members of the base class, which you might not want to expose to the protected members of the derived class.
Note:: that in case of private inheritance, only members of a base class can access private members of that base class. While in the case of protected inheritance, both members of its base class as well as its derived class can access the protected members of that base class.
No comments:
Post a Comment