Suppose I have the following hierarchical structure in Java:
First a class Avo
:
public class Avo {
protected String nome;
public void falar() {
//Codigo aqui
}
}
Then I have a class Pai
that inherits from Avo
and overrides its talk method:
public class Pai extends Avo {
@Override
public void falar() {
//Codigo aqui
}
}
Finally I have a class Filho
that inherits from Pai
and once again overrides the talk method:
public class Filho extends Pai{
@Override
public void falar() {
//Chamar método falar da classe Avo
//Resto da implementação
}
}
Is there any way in the talk method of class Filho
to call the talk method of the superclass Avo instead of the method of the superclass Pai
? I know that in C ++ you can Avo::falar()
, is there something similar in Java?