2 min read

Object Oriented Design (series) - Polymorphism

Object Oriented Design (series) - Polymorphism
Enter the Multi-Verse! 🕷

Intro

Polymorphism describe the ability for an object to have multiple implementations for the same behaviour.

🤝  This can be accomplished by having different classes related to each other through inheritance.  

As we have found in the previous post on inheritance, we can use the @Override annotation to provide a custom implementation for a parent method.

For example, think of an Animal parent class that has a method called eat(). Children classes of Animal could be Bird, Penguin or Dog.

♻️  They also have their own way of eating (some may be vegetarian, others not, etc.)

This post is for subscribers only