No enclosing instance of type PerfHelper is available due to some intermediate constructor invocation

混江龙づ霸主 提交于 2019-12-03 05:38:10
Jordão

Declare the inner class as static and you should be able to extend it:

class outer {
  static abstract class inner extends normal1 { }
}

If inner is not abstract, it's tied to outer, and can only exist when an instance of outer exists. Check to see if this is what you really want.

Nested class are like(in sense ) Property of a class.

  1. As in case of instance variable it only when available when its object is created as same as inner class also available when outer's object will created.

So if you want to extend this then make your inner class as static inner class
As jordao suggest above

Try this, (Read nested class inheritance rules).

abstract class normal1 extends something { }

class outer
{
  abstract class  inner extends normal1{}
}

class Outer1 extends outer
{
  class General extends inner {}
}

In your class General modify its constructor a to call super inner class constructor. here is the code..

public General(){
    new outer().super();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!