Polymorphism with an example?

Answer Posted / sanjeevkumar.v

different form of functions

Is This Answer Correct ?    3 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why polymorphism is used in oops?

818


#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2409


What is encapsulation selenium?

785


What are the two different types of polymorphism?

929


What is polymorphism and why is it important?

809


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(); }

2244


What is the fundamental idea of oop?

896


Why is object oriented programming so hard?

851


What do you mean by Encapsulation?

840


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

1915


What is inheritance in simple words?

850


What is persistence in oop?

900


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

3539


Why we use classes in oop?

815


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

2610