Polymorphism is enforced dynamically (at runtime) based on the actual type of the object that is calling the method. It relies on the ability to assign an object of a subclass to a reference of the superclass.
Also, notice that when you have an instance method in a class and you call another method inside that instance method without using an explicit reference (the reference.method()
syntax), then the call is made through an implicit this
reference which refers to the object actually making the call (in this case, the derived class).
solved How does method redirection takes place in super class and base class?