Scope Type a total of four
1, @public can directly access member variables directly from the member variable name anywhere. (Not recommended)
2, @private can only access member variables directly through the member variable name in the object method of the current class, where it needs to be accessed through the Geter and Seter methods. (The default type of the declared member variable in the @implementation)
3, @protected can only access member variables directly through the member variable name in the object methods of the current class and its subclasses, and it needs to be accessed through the Geter and Seter methods elsewhere. (The default type of the declared member variable in the @interface)
4, @package the member variable of an object can be accessed directly from the member variable name, as long as it is in the same frame. (rarely used, mainly used in framework writing)
Note the point:
1, member variables declared in @interface and @implementation in the same class cannot have the same name.
2, generally no longer declare member variables in @implementation.
3, a member variable declared in a. m file can only be a @private type, even if it is preceded by another scope type @implementation. If the situation differs in other files.
(Self-summary, if there is a mistake wish to point out, thank you)
The scope type of a member variable in a class