Encapsulation

  1. Reduce Complexity
  2. Hide the information which you don’t want to share with the outside world.

So, in simple words, encapsulation means hiding information.

Abstraction

  1. Show only the essential features.
  2. Hide internal process.

So, in simple words, abstraction means hiding implementation.

Let’s see an example to understand encapsulation and abstraction.

Where are Encapsulation and Abstraction in the above example?

Encapsulation

When we make functions IsEmployeeExist and DeleteEmployee access modifier to private then we are doing encapsulation.

Abstraction

We are allowing function CheckEmployee to be accessed from the outside world and hiding the internal process like IsEmployeeExist and DeleteEmployee is abstraction.

--

--