Get from Stackoverflow. The details can easily understand from the below example. class A { public: int x; protected: int y; private: int z; }; class B : public A { // x is public // y is protected // z is not accessible from B }; class C : protected
有两个包pack1和pack2,pack1中是父类,pack2中子类继承自pack1中的父类.这里主要探索一下子类访问父类中protected内部类的问题: 第一个类: package pack1; public class BaseClass { protected class InnerProt {} public class InnerPub{} } 第二个类: package pack2 import pack1.*; public class Mytest extends BaseCl