+ 1
Abstraction V/s Encapsulation
What is the difference between Abstraction and Encapsulation where both tend to hide the implementation details?
1 Antwort
+ 3
Encapsulate hides variables or some implementation that may be changed so often in a class to prevent outsiders access it directly. They must access it via getter and setter methods.
Abstraction is used to hiding something too but in a higher degree(class, interface). Clients use an abstract class(or interface) do not care about who or which it was, they just need to know what it can do.