Turn: http://www.cnblogs.com/burandanxin/archive/2009/12/17/1626734.html
Before explaining the Four keywords, I want to make a simple definition of the relationship between classes. For a class that inherits its own, the base class can think that they are all their children,
The classes under the same package as yourself are considered to be your friends.
1. Public: indicates that the data member and member function are open to all users and can be directly called by all users.
2. Private: Private indicates private. Private means that no one except the class itself can directly use private property. Private property cannot be infringed, even if it is a child or friend, none.
3. Protected: for children and friends, protected is public and can be used freely without any restrictions. For other external classes, protected becomes private.
scope: Other packages of the same package in the current Category
Public √
protected √ ×
friendly √ ×
private √ ×××
note: the default value is friendly when no data is written.