When a base class is inherit as private to derived class then all the public and protected members of base class become private members of derived class but the private member of base class remain private in base class. it means we can access to all the public and protected members of base class in derived class but we can’t directly access the private member of base class in derived class because the private member of base class remain private.
Syntax:
Class base_class_name
{
private:
…………..
public:
…………..
protected:
…………..
};
class derived_class_name : private base_class_name //Private is a access specifier.
{
private:
………….
public:
………….
protected:
………….
};