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 category of soil is highly permeable & excessively drained with low water holding capacity thus require more frequent irrigation for successful cr...
The term 'albedo' primarily indicate?
Which layer of the atmosphere experiences a decrease in temperature with increasing altitude at a rate of approximately 6.5°C per km?
Which scattering phenomenon is responsible for the primary cause of the blue color of the sky?
Which river's basin is associated with the Bhakra Nangal Project in India?
Which phenomenon is characterized by an abrupt increase in temperature at some altitude instead of the expected decrease?
What term refers to the time between the first water supply to the land and the last watering before harvesting?
Which stage of sugarcane is sensitive to water requirement?
Which atmospheric layer contains the maximum concentration of ozone and is critical for absorbing harmful UV radiation?
Which soil type warms up more rapidly due to lower heat capacity and good thermal conductivity?