C# Understanding Encapsulation And Abstraction
Apr 15, 2022
Encapsulation
- Reduce Complexity
- Hide the information which you don’t want to share with the outside world.
So, in simple words, encapsulation means hiding information.
Abstraction
- Show only the essential features.
- 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.