Objective-C ivar visibility 'package' -


when creating ivars in objective-c default visibility 'protected', meaning ivar can accessed subclasses. (if declared in header).

therefore code:

@interface magiccarpet : nsobject {  @protected     nsstring* _threadcount; } 

is same this:

@interface magiccarpet : nsobject {     nsstring* _threadcount; } 

apparently, there's 'package' level visibility. see , use 'public', 'private' , 'protected' visibilities. . . have never seen code 'package'. do?

from apple docs:

@package new instance variable protection class, @public , @protected. @package instance variables behave follows:

  • @public in 32-bit;
  • @public in 64-bit, inside framework defined class;
  • @private in 64-bit, outside framework defined class.

    in 64-bit, instance variable symbol @package ivar not exported, attempt use ivar outside framework defined class fail link error.

this logic seems quite confusing, i'm not @ surprised @package not commonly used.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -