What is polymorphism? Explain with an example.

Answer Posted / adnan zaman

polymorphism means
one interface to many implementations
overloading & overriding examples of polymorphism

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction in oop?

639


#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.

3257


What are the two different types of polymorphism?

674


what is the drawback of classical methods in oops?

2922


Write a program to sort the number with different sorts in one program ??

1922






What does sksksk mean in text slang?

1540


What is oops and its features?

592


i got a backdoor offer in process global,Bangalore..Can i work with it?

2330


What is abstract class in oop?

536


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4248


Why do we need oop?

671


Why do we use class?

638


Why interface is used?

555


What is encapsulation in simple terms?

541


2. Give the different notations for the class.\

1594