Abstraction V/s Encapsulation | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Resposta
+ 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