< Prev
Next >

Python - Polymorphism

As explained in our previous article, the procedure of overriding the definition of a method of a class(being inherited) in its subclass is known as method overriding. This leads to an important concept - Polymorphism.

Polymorphism means having many forms, and in Python it means having different forms/versions of a method(with the same name) in different classes by method overriding.

Doing this, allows a programming structure such as a loop or function or a method to use the objects of a base class or its derived class, to call the forms of overridden method without having to worry about the actual type of object.

Now, which specific form of the overridden method is executed is determined at the runtime, that is based on the type of the object used to make the method call.

Don't worry if you have not got it yet, let us make it easy for you through an example of Polymorphism.

Please Subscribe

Please subscribe to our social media channels for daily updates.

Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page



Please check our latest addition