akila sekaran
,
Ranch Hand
can we call animal's eat() from within one of mammal's methods?
Michael Krimgen
,
Ranch Hand
Hi Akila,
That depends on what is in the (...).
If eat() has the same signature, thus the same list of parameters, the eat-method in mammal overrides the eat-method from animal.
As Bird does not override the eat-method, you still can call the animal's eat method by
Like that, you call bird's eat-method which is the one it inherits from animal.
However, bird also overrides animal's eat-method, there is no way to call animal's eat-method from mammal as super.super.eat() does not work.