有一点需要说明:对于多级派生的,要多个访问标号综合起来看可访问性。 有个简单的方法,见上面的tips.
例如,C 类protected继承自A,那么A中的public成员在C中变成了protected, F类public继承自C,这样在F中A的public成员fun函数为protected,是可见的。
所以F::fun中派生类到基类转换正确。
但是在用户代码中,是不能访问在C,F中变成了protected的A的public成员的,因此C,F对象转换为类A的对象出错。
参考:
http://blog.csdn.net/shanki_pm/article/details/6534222
http://www.cnblogs.com/qingxinlangjing/p/3214472.html
http://blog.csdn.net/geekwangminli/article/details/7930853
From:
http://blog.csdn.net/liufei_learning/article/details/21587085