Wouter Oet wrote:
mohitkumar gupta wrote:
UPCAST
It allows to call methods of Animal not defined in Dog and
Methods overriden by Dog.
No it still calls the methods in Dog and not in Animal (except for static methods).
I think that's what he meant.. If Animal has a fart() then a new Dog() can fart(), but it's defined in Animal, not Dog. However if both Dog and Animal define fart() the implementation in Dog is executed..
Still if you do:
and Dog implements howl();
a.howl() will crash
I just finished posting on what's a definition vs. implementation..Oracle and I disagree... What are people's takes? What does it mean to "define" a method vs. "implement" it?