C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 14)
14.
How many types of polymorphisms are supported by C++?
1
2
3
4
Answer: Option
Explanation:
The two main types of polymorphism are run-time (implemented as inheritance and virtual functions), and compile-time (implemented as templates).
Discussion:
20 comments Page 1 of 2.

Bantishrivastava said:   6 years ago
Two types of polymorphism.
1. Runtime polymorphism.
a.virtual class.

2. Compile time polymorphism.
a. Operator overloading.
b. Function overloading.
(2)

Suri said:   7 years ago
Thanks for the explanation of the answers.

Please give more example for this.

Logi said:   8 years ago
Thanks for the answers with clear explanation.

Amol matre said:   9 years ago
C++ support two types of polymorphism first one is compile time polymorphism and second one is run time polymorphism.

Rohini said:   9 years ago
*Compile Time Polymorphism:

Function overloading and Operator overloading:

Here we are giving various meanings to the functions and operators (we can't use some special operators).

*Run Time Polymorphism:

It is used in inheritance using the key word "virtual" in base class.

Nilay Vishwakarma said:   1 decade ago
There is a very active debate on whether Ad-Hoc polymorphism is a subset of Parametric polymorphism or not.

Also, Coercion is polymorphism only in type theory and not in C++.

So I too would put my bet on "2".

Dixit said:   1 decade ago
Polymorphism is of 4 types:

1. Subtype polymorphism is also known as runtime polymorphism.

2. Parametric polymorphism is also known as compile-time Polymorphism.

3. Ad-hoc polymorphism is also known as overloading.

4. Coercion is also known as (implicit or explicit) casting.

Lachu said:   1 decade ago
Example for operator overloading:

Using (+)operator we can two numbers and also concat the two string("wel"+"come"="welcome").

Soujanya said:   1 decade ago
1. Subtype polymorphism is also known as runtime polymorphism.

2. Parametric polymorphism is also known as compile-time polymorphism.

3. Ad-hoc polymorphism is also known as overloading.

4. Coercion is also known as (implicit or explicit) casting.

Sanjeev kumar said:   1 decade ago
There are basically two types of polymorphism:

1) Operator Overloading (same operator can be used to perform different functions).

2) Function Overloading (name of two function can be same but the return type of function of the number of arguments the function have or the types of arguments must be different. ).


Post your comments here:

Your comments will be displayed after verification.