Java How to call method of grand parents?
- by Arkaha
Let's assume I have 3 classes A, B and C, each one extending the previous one.
How do I call the code in A.myMethod() from C.myMethod() if B also implements myMethod?
class A
{
public void myMethod()
{
// some stuff for A
}
}
class B extends A
{
public void myMethod()
{
// some stuff for B
//and than calling A stuff
super.myMethod();
}
}
class C extends B
{
public void myMethod()
{
// some stuff for C
// i don't need stuff from b, but i need call stuff from A
// something like: super.super.myMethod(); ?? how to call A.myMethod(); ??
}
}