What is polymorphism? Explain with an example.

Answer Posted / sanish joseph

A single entity existing in difernt forms simltniosly s cald
polymorfsm.eg ovrloadn and ovrridin

Is This Answer Correct ?    80 Yes 39 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is inheritance write a program to show use of inheritance?

611


What are benefits of oop?

634


Where is pseudocode used?

563


when to use 'mutable' keyword and when to use 'const cast' in c++

1642


How to use CMutex, CSemaphore in VC++ MFC

4328






what are the realtime excercises in C++?

2333


What is debug class?what is trace class? What differences are between them? With examples.

1604


What is the point of oop?

651


Plese get me a perfect C++ program for railway/airway reservation with all details.

3427


What is overriding vs overloading?

580


what is difference between class template and template class?

2157


Where You Can Use Interface in your Project

1423


What language is oop?

591


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3246


What are the advantages of polymorphism?

573