What is polymorphism?

Wyatt Saltzman
1 min readMay 8, 2021

TLDR

Polymorphism is the ability for a message to be displayed in more than one form. In programming, polymorphism is class objects that belong to the same family hierarchy can have functions with the same name but different behaviors.

Further Explained

To get to this answer it is easier to look at a real-life example. A person can have multiple different characteristics, for example, a woman can be a mother, doctor, and wife at the same time. This same person has multiple characteristics but chooses to use them during different situations. From here you can relate it to computer science by looking at class objects. For example, if you made a shape class and there are classes that inherit the shape class, like squares, circles, and triangles. If you had a function to draw a shape there would be a different output for each shape. You define the draw function as a virtual function and it is a member function when declared in the base class which is overridden by the derived classes(circle, triangle, square).

More Reading

--

--