Start learning 50% faster. Sign in now
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.
Which of the following options accurately describes the ISIN code assigned by SEBI?
Chirag Chandrashekhar Shetty belongs to which of these sports?
Where was the 25th session of the International Small Tea Holders Confederation held for the first time in India?
How many number of Institutions are there in the Insurance Institute of India?
Consider the following statements regarding Save Water Day.
1. On 12 July 2019, the West Bengal government observed Save Water Day ...
Where do you find the temple of Angkorwat?
Find the next number in the series: 8, 16, 32, 64?
"PM Programme for Restoration, Awareness, Nourishment and Amelioration of Mother Earth" (PM-PRANAM) scheme launched in 2023 aims ___________.
How many grand slams has Leander Paes won in doubles and mixed doubles category?
The Ashtadhyayi of Panini is a renowned work on ________.