Question
Which of the following is an example of Polymorphism in
Object-Oriented Programming?Solution
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.
According to the RBI the amount of discount provided on the Sovereign Gold Bond is?
Revenue account includes items related to the _______.
Tele-Law 2.0 initiative was launched on 25 August 2023 marking an important chapter in the evolution of the Tele-Law program of the Department of Justic...
An employee shall be covered under the provisions of the Payment of Wages Act, 1936, should the employee be drawing a maximum monthly wage of:
The Monetary Policy Committee (MPC) at its meeting in December 7, 202 decided to increase the Bank Rate to how much Basis point/percent?
The ‘National Policy on Biofuels’ notified by the Government in 2018 envisaged an indicative target of ethanol blending in petrol. However, conside...
What was the reason for the gathering of people at Jallianwala Bagh to protest and oppose?
Who among the following is the author of the famous novel,‘One Amazing Thing’?
Which music-composer duo was honoured with the National Lata Mangeshkar Award for the year 2020?
Consider the following statement about Center of Excellence (CoE) named ATMAN:
1. Full form of the ATMAN is Advanced Technologies for Monitoring ...