This is a bit confusing while both are like same, cause the definition where abstraction is showing only necessary and the encapsulation is hiding complexity.
It’s seems that they are similar, but actually they’re not, here’s how they are differ:
Abstraction:
- Abstraction is a concept of hiding mechanism (কি লুকাব)
- Only showing those parts which is necessary.
- It is a thought process that is solve in design level.
Encapsulation:
- Encapsulation is the implementation of that concept(কিভাবে লুকাব)
- Hiding complexity.
- Here it is actual process of hiding that is solve in class level.
Real world Example:
Refrigerator :
- Refrigerator Freezing is concept.We Knows only cooling or not cooling (Abstraction).
- How it is done user need not to know (Encapsulation)
Mobile Phone:
- We operate phone using touch screen (Abstraction). We only need to know it’s touch which is working or not!
- We don’t know how the internal mechanism of touch responding circuit connection (Encapsulation).