0

Could someone please explain what is being overridden in the extended superclass "Animal"... when commented out, value remains.

https://code.sololearn.com/c7q3sK59y89p/?ref=app

7th Jan 2018, 11:59 AM
Charles Street
Charles Street - avatar
3 Antworten
+ 3
which is why I think this is a poor example of how to explain inheritance.The animal class contains one method "make sound" soo when the cat class overrides that method commenting the extends has the same results.
7th Jan 2018, 12:22 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
Going forward, things seem like they will make more sense later, "Every Animal makes a sound, but each has a different way to do it. That's why we define an abstract class Animal, and leave the implementation of how they make sounds to the subclasses. This is used when there is no meaningful definition for the method in the superclass."
7th Jan 2018, 2:02 PM
Charles Street
Charles Street - avatar
0
Correct. I dont see why calling in a method to change it's value makes since unless the goal is to grab the superclass variables then rename to current current class, if I am understanding correctly. Thanks for the clarity. Good to know I'm not loosing my mind.
7th Jan 2018, 12:42 PM
Charles Street
Charles Street - avatar