Protected Inheritance
Within a protected inheritance,
- Every public member in the base class is protected in the derived class.
- Every protected member in the base class is protected in the derived class
- Every private member in the base class remains private in the base class and therefore it is visible only in the base class.
For eg,
Class baseA
{
public:
};
private:
int x;
protected:
int y;
int z;
class derivedD:protected baseA
{
private:
int w;
};
A class derivedD is derived from the base class baseA and the access specifier is protected. A data members of the derived class derivedD is int x,y,z,w;
The given table displays the access specifier of the data member of the base class in