adsense


Wednesday, 25 November 2015

C++ LANGUAGE ACCESS CONTROL AND INHERITANCE

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE ACCESS CONTROL AND 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: 



Access             public       protected          private 

Same class     yes               yes          yes 
Derived classes    yes               yes          no 
Outside classes    yes               no          no 

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. 




No comments: