![]() |
accessibilty class
Hello,
I need to understand the accessibility of inheritance. I have this code: :
#include<iostream>I want to understand what is happening at those errors points. I read the documentation of accessibility rules but I am wondering why we dont have an error for :
foo3(objz)can someone help me please? thank you B |
Read the definitions of "public", "private", and "protected".
|
OK relatively to protected inheritance, I quote:
" - inherited public and protected members become protected members of the derived class. - all the inherited members are inaccessible to the rest of the program (main & other non-memberfunctions) - each subsequently derived class has access to the combined set of the protected and public members of the previous base classes.(this is where I get confused in respect to the code I have.)" why foo4(objy) would not compile? When it calls print(),print() calls fn() since all subsequent derived class have access to the previous base class!! |
Quote:
|
| All times are GMT -5. The time now is 1:26 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC