What are the different forms of polymorphism??

Answers were Sorted based on User's Feedback



What are the different forms of polymorphism??..

Answer / suganyamuralidharan

1.Compile time polymorphism
Exhibited by: Function overloading
Operator overloading
2.Run time polymorphism
Exhibited by: Function overriding

Is This Answer Correct ?    22 Yes 3 No

What are the different forms of polymorphism??..

Answer / sriram

A.) Runtime POLYMORPHISM

B.) Compiletime POLYMORPHISMS.,

Is This Answer Correct ?    12 Yes 2 No

What are the different forms of polymorphism??..

Answer / purba phalguni mishra

(1). Operator overloading.
(2). Function overloading.
(3). Virtual functions

Is This Answer Correct ?    11 Yes 3 No

What are the different forms of polymorphism??..

Answer / amit

1.Compile time polymorphism
Exhibited by: Function overloading
Operator overloading
2.Run time polymorphism
Exhibited by: Function overriding

Is This Answer Correct ?    8 Yes 2 No

What are the different forms of polymorphism??..

Answer / amit

There are two types of polymorphism:-
1.Compile time polymorphism
This is achieved by:
- Function overloading
- Operator overloading
2.Run time polymorphism
This is achieved through inheritance and virtual functions.
In this, base class has one or more virtual functions which
are overridden in the derived class. And then base class
pointer is used to access base or derived class virtual
function.

Example:-

class base {
public:
virtual void func() {
cout << "In base class" << endl;
}
};

class derived {
public:
void func() {
cout << "In derived class" << endl;
}
};

int main(){
base *bp, b;
derived d;

bp = &b;
bp->func(); // base class func() will be called

bp = &d;
bp->func(); // derived class func() will be called
return 0;
}

Here, the decision to call base or derived class func() is
taken at run time.

Is This Answer Correct ?    4 Yes 0 No

What are the different forms of polymorphism??..

Answer / mms zubeir

Though there are many answers which are all true to some
extent, I would like to conclude all these into two broad
categories:

1. Ad-hoc polymorphism
2. Parametric polymorphism

As the meaning of the names themselves suggests their usage.

If the range of actual types that can be used is finite
and the combinations must be specified individually prior
to use, it is called Ad-hoc polymorphism.

If all code is written without mention of any specific type
and thus can be used transparently with any number of new
types, it is called parametric polymorphism.

Is This Answer Correct ?    5 Yes 3 No

What are the different forms of polymorphism??..

Answer / ramesh

1.Compile time polymorphism
Exhibited by: Function overloading
Operator overloading
2.Run time polymorphism
Exhibited by: Function overriding

Is This Answer Correct ?    0 Yes 0 No

What are the different forms of polymorphism??..

Answer / sri

Existing in more than one form.

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More OOPS Interview Questions

What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

0 Answers   SRA,


What are objects in oop?

0 Answers  


why oops need in programming

7 Answers   TCS,


what is oppes

2 Answers  


What is the importance of oop?

0 Answers  






any one please tell me the purpose of operator overloading

0 Answers   Amazon,


In the following declaration of main, "int main(int argc, char *argv[])", to what does argv[0] usually correspond? 1) The first argument passed into the program 2) The program name 3) You can't define main like that

6 Answers  


What are the two different types of polymorphism?

0 Answers  


What is the main purpose of inheritance law?

0 Answers  


Why is polymorphism used?

0 Answers  


write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.

4 Answers  


What is the difference between declaration and definition?

20 Answers   IBS,


Categories