Question
In the context of this exercise, what happens if we define a method in the child class with the same name as a parent class method?
Answer
When you define a method in the child class with the same name as a parent class method, it will override the method. Then, when you call the method on an instance of the child class, it will run the method defined in that child class.
To call the original method definition from the parent class, you can use the super
keyword followed by the method name, like so
super.methodName()