Type Here to Get Search Results !

Which of the following best describes polymorphism?

0

 Which of the following best describes polymorphism?

A) The ability to create multiple objects from a single class.
B) The ability to define methods in a child class with the same name as methods in the parent class.
C) The ability to hide data.
D) The ability to combine different objects into a single entity.

Answer: B) The ability to define methods in a child class with the same name as methods in the parent class.

Explanation: Polymorphism allows methods to be defined in a way that they can perform different functions based on the object that is calling them. This is primarily achieved through:

Method Overloading: Same method name with different parameters within the same class.

Method Overriding: A child class providing a specific implementation of a method that is already defined in its parent class. This allows for dynamic method resolution during runtime.

Post a Comment

0 Comments