访问控制-Access Control
Access Control 标识符
标 识 符 | 描 述 |
---|---|
@private | The instance variable is only accessible within the class that declares it and other instances of this class type. |
@protected | The instance variable is accessible within the class that declares it and the instance methods of any of its subclasses. This is the default scope if a protection level is not specified for an instance variable. |
@public | The instance variable is accessible from everywhere. |
@package | The instance variable is accessible from any other class instance or function, but outside the package, it is treated as private. This scope can be useful for libraries or framework classes. |