Using the modern runtime, an@packageinstance variable has@publicscope inside the executable p_w_picpath that implements the class, but acts like@privateoutside.使用modern运行时,一个@package实例变量在实现这个类的可执行文件镜像中其实是@public的,可是在外面就是@private【runtime须要再看一下苹果文档Runtime Programming Guide】 The@packagescope for Objective-C instance variables is analogous toprivate_externfor C variables and functions. Any code outside the class implementation’s p_w_picpath that tries to use the instance variable gets a link error. Objective-C中的@package与C语言中变量和函数的private_extern相似。任何在实现类的镜像以外的代码想使用这个实例变量都会引起link error This scope is most useful for instance variables in framework classes, where@privatemay be too restrictive but@protectedor@publictoo permissive. 这个类型最经常使用于框架类的实例变量,使用@private太限制,使用@protected或者@public又太开放 |