- Reduce Complexity
- Hide the information which you don’t want to share with the outside world.
So, in simple words, encapsulation means hiding information.
- 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?
When we make functions IsEmployeeExist and DeleteEmployee access modifier to private then we are doing encapsulation.
We are allowing function CheckEmployee to be accessed from the outside world and hiding the internal process like IsEmployeeExist and DeleteEmployee is abstraction.