Polymorphism. 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.
IMPORTANT POINTS ABOUT POLYMORPHISM
- A functionality can behave differently for different instances
- The behavior depends on the type of data used in the operation
- Polymorphism is used for implementing inheritance.
ADVANTAGES OF POLYMORPHISM
- It helps programmers reuse the code and classes once written, tested and implemented. They can be reused in many ways.
- Single variable name can be used to store variables of multiple data types(Float, double, Long, Int etc).
- Polymorphism helps in reducing the coupling between different functionalities.
No comments:
Post a Comment