Polymorphism is a fundamental concept in object-oriented programming (OOP) that allows objects of different classes to respond to the same message (method call or function call) in different ways. The word itself means "many forms". In the context of the question, it refers to how data or a message can be handled or processed.
Let's examine each option to see which one best defines polymorphism:
This description is incorrect. While polymorphism deals with messages, processing them all in strictly "one way" contradicts the core idea of "many forms". This sounds more like a single, specific operation.
This is the opposite of what polymorphism means. If a message can only be processed in one form, it lacks flexibility and the "many forms" aspect is missing.
This is the correct definition. Polymorphism allows the same message or data to be interpreted and acted upon in multiple different ways, depending on the context or the object receiving it. For example, a 'speak()' message might result in a 'bark' from a Dog object and a 'meow' from a Cat object.
This option is vague and incorrect. Polymorphism applies to defined messages and data types, not "undefined" ones. While it requires processing in at least one way, the key is the possibility of *multiple* ways.
Based on the analysis, polymorphism fundamentally means that a single interface (like a message or function name) can be used to represent different underlying forms or implementations. Option 3 accurately captures this essence.
Match List I with List II
| List I | List II | ||
| (Programming Paradigm) | (Characteristic) | ||
| A. | Imperative | I. | Declarative, clausal representation, theorem proving |
| B. | Object‐oriented | II. | Side‐effect free, declarative, expression evaluation |
| C. | Logic | III. | Imperative, abstract data type |
| D. | Functional | IV. | Command‐based, procedural |
Choose the correct answer from the options given below :
Let A be the base class in C++ and B be the derived class from A with protected inheritance. Which of the following statement is false for class B?
A member function can always access the data in _______, (in C++).
Which of the following is not correct for virtual function in C++?
Which of the following is correct (in C++)?