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.
He has been absent ________ a fortnight.
I always prefer staying indoors to go out on a summer day.
From the options given below, select the option which states the correct combination of correct sentences.
- The fact is...
Select the correctly punctuated sentence from the options below.
Choose the correct combination of grammatically incorrect sentences
I. The rise of digital technologies and the growth of e-commerce have tran...
From the options given below, select the option which states the correct combination of correct sentences.
- The new wai...
Select the correctly punctuated sentence from the options below.
Below are given some sentences (1), (2), (3), (4) and (5). All the sentences represent the same idea expressed in different ways. You have to choose th...
Select correct prepositions-
called ______ his house yesterday.
What is an adjective?