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

前端 未结 7 1147
执笔经年
执笔经年 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条回答
  • 2020-12-19 04:53

    The problem here is that the synthetic field which links InnerBase to Outer is a private field. Thus, we can only access the outer object from within InnerBase, or if some method or field there provides a reference to the same object.

    0 讨论(0)
提交回复
热议问题