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:
@packagenew instance variable protection class,@public,@protected.@packageinstance variables behave follows:
@publicin 32-bit;@publicin 64-bit, inside framework defined class;
@privatein 64-bit, outside framework defined class.in 64-bit, instance variable symbol
@packageivar 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
Post a Comment