CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C++ DETAILS
Question :
What is polymorphism? Explain with an example?
Category C++ Interview Questions
Rating (4.3) By 40 users
Added on 10/22/2004
Views 7913
Rate it!
Answers:

"Poly" means "many" and "morph" means "form". Polymorphism is the ability of an object (or<br>reference) to assume (be replaced by) or become many different forms of object.<br><br>Example: function overloading, function overriding, virtual functions. Another example can be a plus<br>?+? sign, used for adding two integers or for using it to concatenate two strings.



polymorphism means ability to take more than one form of an object.<br><br>example : polygon.<br>with the same straight lines we can draw octogon,pentagon,hexagon.



 Posted by: NIRMALA DEVI KAMBHAMPATI    

Contact NIRMALA DEVI KAMBHAMPATI  Contact NIRMALA DEVI KAMBHAMPATI

"poly" means many & "morph" means form ,i.e. the ability of object which have many forms is called polymorphism. It has two types 1) Run time polymorphism 2) Compile time Polymorphism <br>function overloading, function overriding,operator overloading are the examples of Compile Time & Virtual Function is example of Run time<br>



 Posted by: suprit714    

Contact suprit714  Contact suprit714

Polymorphism is the ability to use an operator or function in different ways.Polymorphism refers to codes, operations or objects that behave differently in different contexts.<br><br>Below is a simple example of the above concept of polymorphism:<br><br><br> 6 + 10<br><br><br>The above refers to integer addition.<br><br>The same + operator can be used with different meanings with strings:<br><br><br> "Exforsys" + "Training"<br><br><br>The same + operator can also be used for floating point addition:<br><br><br> 7.15 + 3.78 <br><br>Types of Polymorphism:<br><br>C++ provides three different types of polymorphism.<br><br> * Virtual functions<br> * Function name overloading<br> * Operator overloading<br>



 Posted by: Anitha    

Contact Anitha  Contact Anitha

Polymorphism means "one word having different meaning at different instances".



 Posted by: Barkha Tardeja    

Contact Barkha Tardeja  Contact Barkha Tardeja

'poly' means 'many' & 'morph' means 'form'.<br>this phenomenon is used when there is a need to redefine an operation.<br>for eg. to add 2 dates...say..25 &15...there is a need of redefinition of '+'<br>eg. function overloading, etc.



 Posted by: Ankita Leekha    

Contact Ankita Leekha  Contact Ankita Leekha

Poly means many and morph means form , Polymorphism is the ability to use an operator or function in different way.Single function name can be use to perform different functionality.



 Posted by: imtiaz vasesa    

Contact imtiaz vasesa  Contact imtiaz vasesa

Polymorphisam means that in which an object can exhibhit different different behaviour at differnt instances in the program.<br><br>Example:function overloading,operator overloading.



 Posted by: Vishal Tikku    

Contact Vishal Tikku  Contact Vishal Tikku

polymorphism simply means wherever an object of base class is expected an object of derived class is passed



 Posted by: Anthony    

Contact Anthony  Contact Anthony

thats came out from greek lang. where poly means many and morph-form. <br>ex:'+' sign for addititon of integer or concatenate the string.<br>live ex:In a cricket playground, where every player perfom different job.



 Posted by: jaywant topno    

Contact jaywant  topno  Contact jaywant topno

Polymorphism word came from Greek language this means many form .<br>The Polymorphism can take many form of an objects...



 Posted by: Deepak Sharma    

Contact Deepak Sharma  Contact Deepak Sharma

polymorphism is the ability of the data to be prosessed in more than one form.for eg:
class demo
{
float area(float r)
{
float rad=r;
float area=3.14*rad*rad;
cout<<area;
}
void area(float b,float h)
{
float base=b;
float height=h;
float area=0.5*base*height;
cout<<area;
}
};
void main()
{
demo d;
float a,b1,c;
cout<<"enter the radius";
cin>>a;
d.area(a);
cout<<"enter height and breadth";
cin>>b1>>c;
d.area(b1,c);
}



 Posted by: swati sharma    

Contact swati sharma  Contact swati sharma

polymorphism means the ability to take more performs only single person.
eg:a single persons can marketing,training,manging.



 Posted by: divya    

Contact divya  Contact divya

Whenever an object of base class
is acccepted .You can pass the object
of derive class.



 Posted by: Dharmendra    

Contact Dharmendra  Contact Dharmendra


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is the difference between an object and a class?
View Answer
What is encapsulation?
View Answer
What is abstraction?
View Answer
What do you mean by binding of data and functions?
View Answer
Difference between realloc() and free()?
View Answer
What is function overloading and operator overloading?
View Answer
What is virtual class and friend class?
View Answer
What do you mean by inline function?
View Answer
What is a template?
View Answer
What is RTTI?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C++ Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/951/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.62