i**p 发帖数: 902 | 1 One class A is privately inherited by B, and B is privately inherited by C.
a protected member in class A can be accessed by member of class B but not
by C.
Is there any good reason to design the C++ this way? Is there any porblem if
it were accessible by class C? |
p***o 发帖数: 1252 | 2 B inherits A privately. That means no other class should know B inherits A.
if
【在 i**p 的大作中提到】 : One class A is privately inherited by B, and B is privately inherited by C. : a protected member in class A can be accessed by member of class B but not : by C. : Is there any good reason to design the C++ this way? Is there any porblem if : it were accessible by class C?
|
i**p 发帖数: 902 | 3 So even a public member in A should not be accessilbe from C, right?
【在 p***o 的大作中提到】 : B inherits A privately. That means no other class should know B inherits A. : : if
|
d****2 发帖数: 6250 | 4 right, C only knows B and everything in B belongs to A is private now.
【在 i**p 的大作中提到】 : So even a public member in A should not be accessilbe from C, right?
|