Encapsulation
Enclosing all parts of an abstraction within a container
Benefit
- to pretect access to the encapsulated (hidden) data or operation
- Increased modularity.
|
Language Specific
- Most languages like Java have a "protection type"
that can be applied to data and operations.
- Publish access operations so users of a class are encoraged
to use these and not directly/access data.
- getX(), setX() operations.
In Java: Can do information hidding with protection type
declarations of private, public, protected, package protected.
|
|