What is the package
One of the three characteristics of object-oriented 1
Concept for the packaging of
No class will write information hidden within the class, it does not allow direct access to external programs, but to achieve the operations and access to hidden information provided by the methods of the class
Two substantially encapsulated principle
Put as many things to hide, the external interface to provide convenient
All the attributes to hide
How to implement the package :
1 modify the properties of visibility (set to private, to prevent erroneous modification)
2 creates a public getter / srtter method (for read-write property)
3 was added in the control period getter / setter method (determining the legitimacy of the attribute values)