我希望这个代码说明问题:如何从嵌套类访问超类方法?
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?
}
}
}
我知道,我可能会做一些错误的,因为继承或许不应该以这样的方式使用。但这是我情况最简单的方法。除此之外,我只是好奇。可能吗?