Home / Questions / What is the main benefit of Polymorphism?
Explanatory Question

What is the main benefit of Polymorphism?

👁 17 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Polymorphism allows the same method name to behave differently based on the object calling it.

Benefits:

  • Flexibility in code

  • Extensibility

  • Clean and maintainable programs

Example:
A method makeSound() behaves differently for Dog, Cat, and Cow.