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又太開放 |