Encapsulation Flashcards
means hiding the structure and implementation of an object while
exposing only the essential features (interface) in the perspective of the user(s) of the object.
Encapsulation
means protecting your class or its instances from abuse or misuse.
Encapsulation
How to do we protect classes and attributes?
1) By making attributes private
2) By selectively making methods private
3) Through structural hierarchy (organizing classes into packages)
A feature can be declared with an ______________ to alter its visibility with respect to other classes
access modifier
What type of access modifier?
Others can use it
Public
What type of access modifier?
Package-mates can use it
Default
What type of access modifier?
Only the class can use it
Private