由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - protected class member in C++
相关主题
C++ Q01: private inheritance.protected/private inheritance
什么地方用到 Private inheritanceC++ Primer 上关于inheritance protected member 的一段话
两个看来相似的问题考考大家,其实也不只是C++,C#/Java也一样
请问C++小白问题inheritence problem
C++ Q96: function inheritance (转载)类设计问题求助
Why oop is bad?C++ (with MATLAB engine) compiling problem under Linux systerm
问一个inheritance的初级问题关于c++ classes的interview test
ask a C++ inheritance questionone question about struct
相关话题的讨论汇总
话题: class话题: c++话题: member话题: privately话题: inherited
进入Programming版参与讨论
1 (共1页)
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?
1 (共1页)
进入Programming版参与讨论
相关主题
one question about structC++ Q96: function inheritance (转载)
C++菜鸟问题请教: class versus structure.Why oop is bad?
C++ cast 小结问一个inheritance的初级问题
about multiple inheritanceask a C++ inheritance question
C++ Q01: private inheritance.protected/private inheritance
什么地方用到 Private inheritanceC++ Primer 上关于inheritance protected member 的一段话
两个看来相似的问题考考大家,其实也不只是C++,C#/Java也一样
请问C++小白问题inheritence problem
相关话题的讨论汇总
话题: class话题: c++话题: member话题: privately话题: inherited