Polymorphism in Object-Oriented Programming (OOP) allows methods to be defined in different forms across different derived classes, typically by overriding or overloading methods. This enables a single method to exhibit multiple behaviors, depending on the object that invokes it. For example, a base class method draw() in a shape class could be defined differently in derived classes like Circle and Rectangle, where each class implements its unique version of draw(). This approach promotes flexibility, reduces code duplication, and allows developers to manage code easily as new classes are added, embodying one of OOP’s core principles. Polymorphism is critical for creating extensible and maintainable code, as it enables a system to process objects of various types through a common interface. Option A (Encapsulation) - Encapsulation is the OOP principle of hiding internal details and exposing only necessary features through a class interface, which differs from polymorphism’s focus on varied behaviors. Option C (Aggregation) - Aggregation describes a "has-a" relationship between classes, where one class contains references to another, unrelated to polymorphic behavior. Option D (Encapsulation) - This concept of grouping related fields and methods within a class refers to encapsulation, not polymorphism. Option E (Unrelated Classes) - Allowing objects of unrelated classes to connect without a common functionality does not represent polymorphism, which requires shared interfaces or inheritance.
The housewife _______ the cakes were burning, and ran to switch off the oven.
The novel’s __________ plot left readers guessing until the very end, making it a compelling page-turner.
Educate your children and let them learn to live with ________.
(A) elevation (B) dignity (C) respect ...
As the habitat and food is shrinking, so are the numbers of house sparrows. The new building designs and landscaped gardens are not at all sparrow frien...
Choose the correct answer to fill the given blank
The teacher asked the students _____ their homework.
Select the most appropriate option to complete the sentence.
The committee did not acknowledge that he __________ wrong.
Her stories paid _____ to her mother, whom she regarded as the goddess of bravery.
It was after his death that the masterpiece _____________ by the poet got exposed to the world.
The century-old Cauvery water _________ between Tamil Nadu and Karnataka could see a final settlement with the Supreme Court.
Despite the efforts to make the designs more unique, the new products are still considered ___________ (distinct) from the old ones.