ABSTRACTION Vs ENCAPSULATION
Both are a design and compliments each other.
Abstraction design tells , you should "Show only necessary" menthods to user of your class and Encapsulation tells "Hide All the complexity" of your class.
Abstraction:
Say
Public class Employee {
public void updateSalary() // this one is Public and will be exposed to world
#Some private property
This interns calls
getSalary() --> Private
checkCreditLimits(), // Private
#and other API
}
Encapsulation
Here #Some private property will never be visible to user of this class/object
Both are a design and compliments each other.
Abstraction design tells , you should "Show only necessary" menthods to user of your class and Encapsulation tells "Hide All the complexity" of your class.
Abstraction:
Say
Public class Employee {
public void updateSalary() // this one is Public and will be exposed to world
#Some private property
This interns calls
getSalary() --> Private
checkCreditLimits(), // Private
#and other API
}
Encapsulation
Here #Some private property will never be visible to user of this class/object