I've looked at other definitions and explanations and none of them satisfy me. I want to see if anybody can define polymorphism in at most two sentences without using any code or examples. I don't want to hear 'So you have a person/car/can opener...' or how the word is derived (nobody is impressed that you know what poly and morph means). If you have a very good grasp of what polymorphism is and have a good command of English than you should be able to answer this question in a short, albeit dense, definition. If your definition accurately defines polymorphism but is so dense that it requires a couple of read overs, then that's exactly what I am looking for.
Why only two sentences? Because a definition is short and intelligent. An explanation is long and contains examples and code. Look here for explanations (the answer on those pages are not satisfactory for my question):
Polymorphism vs Overriding vs Overloading
Try to describe polymorphism as easy as you can
Why am I asking this question ? Because I was asked the same question and I found I was unable to come up with a satisfactory definition (by my standards, which are pretty high). I want to see if any of the great minds on this site can do it.
If you really can't make the two sentence requirement (it's a difficult subject to define) then it's fine if you go over. The idea is to have a definition that actually defines what polymorphism is and doesn't explain what it does or how to use it (get the difference?).
Polymorphism is language functionality allowing high-level algorithmic code to operate unchanged on multiple types of data. And the other sentence, whatever it was for... ;-P.
( The types C++ supports are listed and contrasted in my answer: Polymorphism in c++ )
Entities of the same type (that is, implemented same interface or derived from same class), behave in different ways (under same method name).
Multiple implementations of the same interface.
Example: Many models of telephone implement the numeric keypad interface.
Polymorphism is when different objects respond to the same method in a different way. For example, a car moves on the road while a person walks on the road. Those are two objects responding to the same road in a different way.
It seems that the best definitions are provided here, so let me add my two cents please, just for other observers. I hope it could help more.
There are two kinds of polymorphism:
That is simply method overloading and operator overloading
The first term is inherited from the Java and C++ terminology.
But in the .NET terminology only the second one (I mean run time polymorphism) is really supposed as polymorphism and simply called polymorphism.
And as far as I know there are three methods for implementing (run time) polymorphism.
A simple example Of interface-based polymorphism:
Output:
For a given method signature, different method implementations are run for different, hierarchically related, classes.