Question
Which of the following best illustrates the concept of
polymorphism in Object-Oriented Programming (OOP)?Solution
Polymorphism in OOP refers to the ability of a function, method, or object to take on multiple forms. This characteristic allows developers to design interfaces or methods that can perform different tasks based on context. 1. Method Overloading: One of the primary examples of polymorphism is method overloading, where multiple methods share the same name but differ in argument types or counts. 2. Dynamic Behavior: Polymorphism also enables dynamic method invocation at runtime, allowing a subclass to provide a specific implementation for a method defined in its superclass. 3. Extensibility: By allowing objects to process different behaviors through a unified interface, polymorphism enhances code flexibility and scalability. Why Other Options Are Incorrect: • B) A class inheriting properties: This describes inheritance, not polymorphism. • C) Combining multiple objects: This relates to composition, which involves creating a complex object from simpler ones. • D) Restricting access: This refers to encapsulation, which controls data accessibility within a class. • E) Relationships between objects: This describes association or aggregation, not polymorphism.
Perimeter of a square shaped plot is 96 metres and the area of a rectangular plot is 65% more than that of the square shaped plot. Find the area (in m
Length and breadth of a rectangular room are in the ratio 4 ∶ 5. The perimeter of the room is 180 m. Cost of flooring is Rs. 75 per square metre. Find...
A diagonal of a rhombus is 6 cm. If its area is 24 cm, then the length of each side of the rhombus is?
If the radius and height of a right-angled cone is 21metres and 18metres, individually, then find the volume of the cone.
- A rod of length of 616 cm and 35cm radius is melted and converted into a sphere of radius 21cm, find how many such proper spheres can be made?
If the circumference of a circle is 352 cm then find the area of the circle?
If the volume of a cylinder is 486π and the ratio of radius to its height is 3:2 then find the curved surface area of cylinder?
If the side of square and its area is in the ratio of 1:9 then find its perimeter?
'A storage room has a floor area covered with tiles of size 60 cm × 40 cm. If the room measures 4.8 meters in length and 3.2 meters in width, how many ...
Two third part of cylinder is full of water. When we tilt the cylinder in such a way that the water becomes diagonal shape, in this process 87.5 litre o...