C++ Public access specifier

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

syntax:

Class base_class_name

{

private:

…………..

public:

…………..

protected:

…………..

};

class derived_class_name : public base_class_name  //Public is a access specifier.

{

private:

………….

public:

………….

protected:

………….

};

Leave a Reply

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