non-public inheritance | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

non-public inheritance

why no one question about non-public inheritance?

27th Aug 2016, 7:21 PM
Ernst Maurer
Ernst Maurer - avatar
2 Answers
+ 1
Public inheritance: Public members of the base class become public members of the derived class and protected members of the base class become protected members of the derived class. Protected inheritance: Public and protected members of the base class become protected members of the derived class. Private inheritance: Public and protected members of the base class become private members of the derived class. You probably won't ever need to use anything but public inheritance.
27th Aug 2016, 8:05 PM
Zen
Zen - avatar
0
this can be used not so often, but I'm facing with it (private only, no one protected) from time to time. here is a perfect sample from guru :) http://www.gotw.ca/gotw/040.htm
27th Aug 2016, 8:09 PM
Ernst Maurer
Ernst Maurer - avatar