C# Understanding Encapsulation And Abstraction

Encapsulation

  1. Reduces complexity
  2. Hides the information that you don’t want to share with the outside world.

In simple words, encapsulation means hiding information.

Abstraction

  1. Shows only the essential features
  2. Hide internal processes.

In simple words, abstraction means hiding implementation(s).

Here is an example to understand encapsulation and abstraction.

Where are Encapsulation and Abstraction in the above example?

Encapsulation

When we convert the functions IsEmployeeExist and DeleteEmployee access modifiers to private, then we have done encapsulation.

Abstraction

When we allow the function CheckEmployee to be accessed from the outside world and hide the internal processes like IsEmployeeExist and DeleteEmployee as an abstraction.


Similar Articles