Type Here to Get Search Results !

Which of the following is a benefit of using polymorphism in OOP?

0

 Which of the following is a benefit of using polymorphism in OOP?

A) Increased code complexity.
B) Reduced memory usage.
C) Improved flexibility and maintainability of code.
D) Eliminating the need for inheritance.

Answer: C) Improved flexibility and maintainability of code.

Explanation: Polymorphism allows methods to be used in a generic way, letting one interface handle different data types. This flexibility enhances code maintainability, as changes to one part of the code (like adding a new subclass) don’t necessarily require changes to other parts of the code that use polymorphic behavior.

Post a Comment

0 Comments