This question already has an answer here:
I understand what Polymorphism is, but since I only ever programmed in Java and 'dived' pretty quickly into OOP, I'm having a hard time understanding exactly what it's benefits are (and I feel the same about a lot of other OOP principles and concepts).
Please explain to me how the OO programmer benefits from Polymorphism, and what exactly it's good for. Comparing it with procedural code that does pretty much the same thing but without Polymorphism, will also be helpful.
EDIT: To clarify, I'm referring to the kind of Polymorphism that allows you to operate generically on an object, without having to know or depend on it's specific type.
For example, consider a class
Person. It implements several methods, one of them
eat(). It has two subclasses,
Adult. I have a collection of objects that can be of type
Adult. And I want them all to eat. Using Polymorphism, I can call
eat() on any one of them without caring about it's specific type or having to implement logic to specifically make an adult eat or a child eat.
This kind of Polymorphism is mainly what I am referring to.
However I gave a very generic example for it's benefits, and I still don't understand completely why - 'in the real world' - it's such a big improvement as opposed to not using Polymorphism.
(Again, I know what Polymorphism is and how to use it in a program, but since I have no experience in programming in a non-OO style, I can't compare working with Polymorphism to not using it and thus can't understand it's benefits completely).