Header Ads Widget

Accessing base class members: Inheritance

 Access Control and Inheritance


A derived class can access all the non-private members of its base class. Thus base- class members that should not be accessible to the member functions of derived classes should be declared private in the base class.

We can summarize the different access types according to - who can access them in the following way −


A derived class inherits all base class methods with the following exceptions −

 Constructors, destructors and copy constructors of the base class.

 Overloaded operators of the base class.

 The friend functions of the base class.