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

前端 未结 7 1145
执笔经年
执笔经年 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.

提交回复
热议问题