-
Polymorphism is a made up of two words Poly which means Many and Morph which means Forms.
-
Multiple classes with the same method but with different implementation.
-
Implement many different implementations of the same method.
-
Classes have different functionality but they share common interference.
-
in Ruby, it means being able to send the same message to different objects and get different results.
Let’s look at a few different ways to achieve this.
We can implement polymorphism using :
-
Polymorphism using Inheritance
-
Polymorphism using Duck-Typing
Misc links
https://thoughtbot.com/blog/back-to-basics-polymorphism-and-ruby