how can we use protected keyword?
how can we use protected keyword?
Collapse
X
-
The protected keyword is used when the base class contains members that need to be accessible in a derived class without having to use a base class member function.
This is usually done when the base class is incomplete and it to be completed by a derived class. Here the intent is to create and use derived objects as deriuved objects but have the base class contain the data or ogic that is common to all derived classes without having to expose this information to classes outside the hierarchy.
Comment