我有一个抽象类:
public abstract class Parent{
public void cook(){
DoSomething(); //call abstract method
}
protected abstract void DoSomething();
}
我有一个具体的类来实现上述抽象类:
public Child extends Parent{
private Toy toy;
public void initToy(){
toy.setOnPlayListener(new OnPlayListener() {
@Override
public void onPlay() {
//How to call parent class cook() method here?
}
});
}
@Override
public void DoSomething(){...}
}
我想在类中的 override函数中调用当前 Child 实例下的类的cook()
方法。怎么做?Parent
onPlay()
OnPlayListener()
Child
========更新=======
感谢您的回答,现在我想澄清一下,是Child.super.cook()
和Child.this.cook()
同一件事吗??