How to make an outer class inherited from an inner class?

前端 未结 7 1163
执笔经年
执笔经年 2020-12-19 04:08

How can I make something like this work:

class Outer {
  int some_member;

  abstract class InnerBase {
    abstract void method();
  }
}

class OuterExtends         


        
7条回答
  •  猫巷女王i
    2020-12-19 04:50

    The answer is: you can't, because it would break encapsulation. Only InnerBase can have access to attributes of Outer, not OuterExtendsInner. It is not direct inheritance. InnerBase does not inherit of Outer.

提交回复
热议问题