Search⌘ K

What is Polymorphism?

Explore polymorphism to understand how a single method name can invoke different behaviors in various Python classes. Learn how subclass methods override parent declarations to calculate specific outcomes like shape areas, helping you write modular and manageable code.

Definition

The word Polymorphism is a combination of two Greek words, Poly meaning many and Morph meaning forms.

In programming, polymorphism refers to the same object exhibiting different forms and behaviors.

For example, take the Shape Class. The exact shape you choose can be anything. It can be a rectangle, a circle, a polygon, or a diamond. While, these are all shapes, their ...

Many shapes