我希望这段代码解释了这个问题:
class Foo {
void a() { / *stuff */ }
}
class Bar extends Foo {
void a() { throw new Exception("This is not allowed for Bar"); }
class Baz {
void blah() {
// how to access Foo.a from here?
}
}
}
Run Code Online (Sandbox Code Playgroud)
我知道我可能做错了什么,因为继承可能不应该以这种方式使用.但这是我情况下最简单的方法.而且,除此之外,我只是好奇.可能吗?
ILM*_*tan 16
Bar.super.a()
似乎工作.
班级名称 .超级 NonWildTypeArguments_opt标识符(ArgumentList_opt)
是一个有效的MethodInvocation