We start the next series of episodes with a polymorphism overview. This is a core concept for proper object-oriented design. Likewise, we will dig into several practical ways to use this.
Polymorphism Overview – A Definition
As with many topics, it seems best to start with a definition from Wikipedia.
In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.
For our purposes, that symbol that is referred to can be considered a name. The name can be a method, class, or property name.
Class Vs. Object
It is worth clarifying the difference between a class and an object. We will be talking about these two terms a lot from here on out. Therefore, let’s remove any confusion. A Class is the definition of a class. Think of it as a set of rules or a template. A simple pseudo-code example is below.