Polymorphism
You can override an inherited method which opens the door to polymorphism.
In the example above, getHourlyPayRate()
is dispatched based on the actual "type" of the courseAssistant
argument. It will decide on dispatching the overloaded getHourlyPayRate()
during runtime, which is a (dynamic) polymorphic behavior.
Method overriding in JavaScript means that you can have methods with the same name in parent and subclasses.
Aside: JavaScript does not support method overloading since the number of arguments to a method can be fewer/more than declared parameters.