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.
2, 4, 12, 20, 30, 42
18000 3000 600 150 40 25
1, 1, 3, 15, 105, 942
Find the wrong number in given number series.
2010, 2018, 1998, 1982, 1950, 1886
There are two wrong number series given in question and three relationships has been derived from that you have to answer the correct relationship betwe...
164, 20, 216, -40, 284, -112
Find the wrong number in the given number series.
2, 3, 5, 7, 11, 13, 17, 20
Find the wrong number in given number series.
3910, 3879, 3786, 3631, 3414, 3235.
100, 101, 126, 207, 376, 660, 1106