Difference Between Data Hiding and Data Encapsulation

Difference between data encapsulation and hiding.
The main difference between data hiding and data encapsulation are in the below.

Data Encapsulation
  1. Encapsulation is the process of combining data and function into a single unit called class.
  2. The data in encapsulation is either public or private.
  3. The data is encapsulated using the class keyword.

Data Hiding
  1. Data Hiding is the mechanism where the details of the class are hidden from the outside world.
  2. The data in data hiding is considered as private and non-accessible.
  3. The data hiding is implemented the access specifier. i.e - public, private & protected.

Post a Comment