Are Encapsulation and Data Hiding Same?

Are Encapsulation and Data Hiding Same?

Data hiding and encapsulation are correlative ideas. Data hiding concentrates on the accessibility of an object, while encapsulation concentrates on how the data is accessed and how different objects behave.

Why is encapsulation known as data hiding?

In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding. ... Provide public setter and getter methods to modify and view the variables values.

Is information hiding result of encapsulation?

Information Hiding - It is the process of hiding the implementation details of an object. It is a result of Encapsulation.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.