+ 1

Abstraction V/s Encapsulation

What is the difference between Abstraction and Encapsulation where both tend to hide the implementation details?

15th Mar 2017, 11:06 AM
Paras Waqar
Paras Waqar - avatar
1 Odpowiedź
+ 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.
15th Mar 2017, 1:22 PM
Felipe Cruz
Felipe Cruz - avatar