Why encapsulation is known as Data Hiding? [closed]

You are “hiding” data from users of your object that should be able to use it without needing to know about its internals.

The main reason for this is to allow you to later change these internals without breaking the code that calls into your object.

This is a technique to improve software maintainability.

Common misconception: It should definitely not be seen as a security measure (in the sense that it protects sensitive data from malicious actors that should not be allowed to gain access to it — encapsulation does no such thing).

Leave a Comment