In object-oriented programming, what does polymorphism allow?
A
Functions to run without parameters
B
Objects to store data only
C
Classes to prevent inheritance
D
Objects to take multiple forms through overriding or overloading
Correct Answer: Option D — Objects to take multiple forms through overriding or overloading
Explanation:
Polymorphism allows objects to take multiple forms, enabling a single interface to represent different underlying data types or behaviors. T...
Polymorphism allows objects to take multiple forms, enabling a single interface to represent different underlying data types or behaviors. This is typically achieved through method overriding, where a subclass provides its own implementation, or overloading.