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.
Which of the following appointments is not made by the President of India?
If the court wants to form an opinion as to any law contained in any Bare act, the opinion shall be relevant? If yes under which section of the Indian E...
Before the industrial disputes act was implemented in the year 1947, which act took care of the industrial disputes?
To prove the case of alibi, the burden of proof lies on
Which function allows the Board to modify or reject proposals for providing infrastructure facilities in a SEZ?
As per the Bharatiya Nyaya Sanhita, 2023 ____________ means a group of two or more persons who, acting either singly or jointly, as a syndicate or gang...
Which Section (s) gives (s) protection to Judges and to those who carry out their orders against criminal process?
Art. 338 provides that there shall be a National Commission for?
Which provisions in the Constitution of India pertain to Co-operative societies?
How many kinds of punishment are there under IPC?