How to access a superclass method from a nested class?
Posted
by m01
on Stack Overflow
See other posts from Stack Overflow
or by m01
Published on 2010-04-21T20:05:16Z
Indexed on
2010/04/21
20:13 UTC
Read the original article
Hit count: 146
java
|inheritance
I hope this code explains the problem:
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?
}
}
}
I know that I may be doing something wrong, because inheritance perhaps shouldn't be used in such way. But it's the easiest way in my situation. And, beside that, I'm just curious. Is it possible?
© Stack Overflow or respective owner