I do not understand the difference between data hiding and Encapsulation. Are these two same or different? If these two are different then what is the difference between the two
Encapsulation Is the process of hiding sensitive data of object from user. To achieve this, we must declare class variables/attributes as private.
Here's an example of typical encapsulation:
Can you help me to understand the difference between the two. How they are different from each other ?
Encapsulation Is the process of hiding sensitive data of object from user. To achieve this, we must declare class variables/attributes as private.
Here's an example of typical encapsulation:
Code:
class MyClass
{
public:
int a //public member
private:
int x; //private member
int y;
};