C++ Protected access specifier

When a base class is inherit as protected to derived class then all the public and protected members of base class become protected members of derived class but the private member of base class remain private in base class.

SYNTAX:

Class base_class_name

{

private:

…………..

public:

…………..

protected:

…………..

};

class derived_class_name : protected base_class_name  //Protected is a access specifier.

{

private:

………….

public:

………….

protected:

………….

};

Leave a Reply

Your email address will not be published. Required fields are marked *