Generally, the ability to appear in many forms. In object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes.
So you can inherit from a base class, and override base class methods. Then even if the base class method is referenced in a base class variable containing an derived class instance, the system calls the derived class method instead of the base.
Suppose you have a base Animal class, and derive Cat and Dog classes from it.
If the base class has a Feed method, you can then override that in both Cat and Dog classes to ensure the right food and quantity is fed to the right animal type: 85g Whiskas for the Cat class, 250g of Pedigree Chum for the dog.
If you then loop through all your Animals you would use an Animal variable and just call Feed:
for (Animal animal : animals) {
animal.Feed();
}
The system looks at what type is currently in
animal
and calls the appropriate Cat.Feed or Dog.Feed as necessary. You don't have to concern yourself about what type of Animal it is, the system works it out for you based on the instance being processed at the time.
That is the essence of Polymorphism: the ability to appear in many forms!
Make sense now?