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



c++ provides classes...and classes do what we want but why then strcut are used...if we say data h..

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

Post New Answer

More OOPS Interview Questions

What is the difference between C++ and java?

6 Answers   Atos Origin,


write a program to print * * * * * *

2 Answers  


What are the benefits of interface?

0 Answers  


What is overloading and its types?

0 Answers  


Why is object oriented programming so hard?

0 Answers  






char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output

9 Answers   Persistent,


What are the 5 oop principles?

0 Answers  


What is balance factor?

0 Answers  


What is the difference between encapsulation and polymorphism?

0 Answers  


What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

1 Answers  


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

0 Answers  


What is abstrac class?where is it use?

2 Answers  


Categories