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?
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.