Question
Which of the following best illustrates the concept of
polymorphism in Object-Oriented Programming (OOP)?Solution
Polymorphism in OOP refers to the ability of a function, method, or object to take on multiple forms. This characteristic allows developers to design interfaces or methods that can perform different tasks based on context. 1. Method Overloading: One of the primary examples of polymorphism is method overloading, where multiple methods share the same name but differ in argument types or counts. 2. Dynamic Behavior: Polymorphism also enables dynamic method invocation at runtime, allowing a subclass to provide a specific implementation for a method defined in its superclass. 3. Extensibility: By allowing objects to process different behaviors through a unified interface, polymorphism enhances code flexibility and scalability. Why Other Options Are Incorrect: • B) A class inheriting properties: This describes inheritance, not polymorphism. • C) Combining multiple objects: This relates to composition, which involves creating a complex object from simpler ones. • D) Restricting access: This refers to encapsulation, which controls data accessibility within a class. • E) Relationships between objects: This describes association or aggregation, not polymorphism.
A series is given with one term missing. Choose the correct alternatives from the given ones that will complete the series.
21, 46, 82, 131, 1...
Article 243E of the Indian Constitution is related to which feature of Panchayat?
A copy of the famous 16" century art work Salvator Mundi, which was reportedly stolen, has recently been recovered by the Police in Italy. The painting ...
Which one of the following is the correct chronological sequence of the given Bhakti Saints?
Who is the author of Vikramakacharita?
22nd Summit of the SCO Council hosted by which ministry ?
Who flagged off the Baba Saheb Ambedkar Yatra Bharat Gaurav Tourist train from New Delhi and what is the purpose of this train?
In which year was The Indian Museum Act passed?
Consider the following statements:
- Uttar Pradesh hosted the third edition of 'Khelo India' Games
- Over 4,000 ath...
India’s first pure green hydrogen plant commissioned at which place?