Polymorphism allows one interface to represent multiple implementations . This can occur through method overriding , where a subclass provides a specific implementation for a method declared in its parent class, or method overloading , where methods have the same name but different parameters. For instance, an Animal class might have a sound() method overridden in subclasses like Dog or Cat to produce specific sounds. Polymorphism enables flexibility and extensibility, as the same method can be applied differently based on the object. Why Other Options Are Incorrect : 2. A class that inherits properties from another class : This is Inheritance , not Polymorphism. 3. A class that uses another class as a part of its definition : This describes Composition , where objects are combined to form complex systems. 4. A way to restrict access to certain class members : This is Encapsulation , not Polymorphism. 5. A way of dividing a complex system into smaller components : This is closer to the concept of Modularization , unrelated to Polymorphism.
Six boxes G, T, D, S, L and W are kept one above another. The bottommost box is numbered as 1 and the topmost box is numbered as 6. G is three boxes bel...
In the following question, select the related number from the given alternatives.
68 : 70 :: 45: ?
Select the related letters from the given alternatives.
UCZ : PHU : : VGS : ?
Select the option that is related to the third number in the same way as the second number is related to first number and the sixth number is related t...
Given set: [99, 200, 301]
Cobbler : Leather: : Weaver : ?
Bird : Fly :: Lion :: ?
Select the option that is related to the third letter-cluster in the same way as the second letter-cluster is related to the first letter-cluster.
<...Figure A is related to B following a certain pattern. Following the same pattern, figure C is related to D. Study the pattern and select the figure whi...
In the following question, select the related word pair from the given alternatives.
Wisdom: Knowledge :: Naivety: ?