what is data hiding.

Answer Posted / arvind

Data & Functions in C++ are private by default. That means there is no previlige outside the class. The functions or objects defined outside the class can't access the data and functions.So by making data and functions private with in the class, its making the data hiding and function hiding. By default data is private and functions are public. So this is the concept of data hiding

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is protected in oop?

805


What is the example of polymorphism?

740


What is meant by oops concept?

778


what are the realtime excercises in C++?

2541


What is overriding vs overloading?

778


What is pointer in oop?

723


Why is polymorphism used?

768


Why do we need polymorphism in c#?

874


What is difference between data abstraction and encapsulation?

829


What does oop mean in snapchat?

915


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

3512


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

861


What is difference between abstraction and encapsulation?

807


Why do we use inheritance?

812


Why do we use encapsulation in oops?

745