Polymorphism
- Sometimes a certain behavior is called the same thins in a number of different classes
- For example you can open a door, open a window, open a book, open a fridge etc
- In each of these cases, the behavior is called the same thing (open) but carries out a different set of actions.
- Polymorphism(which mean 'many forms') allows a single statement to invoke a variety of different behaviors. The system knows which behavior is the right one to carry out even though the same statement is used each time.
No comments:
Post a Comment