c++ provides classes...and classes do what we want but why
then strcut are used...if we say data hiding... it is also
provided by c++ in structs then why to prefer clasess
Answer / rasagna
resuability is the excellent concept in cpp. we can reuse
the functions many times.but in c we have not that type of
facility. classes gives redability and data security
(because of access specifier)to program. oop(object
oriented program) gives class as high in cpp.because of
inheritance,polymorphism,data independence.encapsulation.
At last what i want to say is
c + extra reatures = c++.
c + class = c++
Is This Answer Correct ? | 7 Yes | 0 No |
What is the difference between C++ and java?
write a program to print * * * * * *
What are the benefits of interface?
What is overloading and its types?
Why is object oriented programming so hard?
char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output
What are the 5 oop principles?
What is balance factor?
What is the difference between encapsulation and polymorphism?
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
#include <stdio.h> #include <alloc.h> #include <stdlib.h> #include <conio.h> 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.
What is abstrac class?where is it use?