Private Inheritance
Within a private derivation,
- Every public member in the base class is private in the derived class.
- Every protected member in the base class is private in the derived class
- Every private member in the base class remains private in the base class and therefore it is visible just in the based class
For eg,
Class baseA
{
public:
};
private:
int x;
protected:
int y;
int z;
class derivedD:private baseA
{
private:
int w;
};
A class derivedD is derived from the base class baseA and the access specifier is private. 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 the derived class: