假设我有 3 个类A
,B
并且C
,每个类都扩展了前一个类。
我如何A.myMethod()
从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(); ??
}
}