When defining classes in objective-C, you can also use public and private variables similar to C ++ to modify member variables, as shown below:
@ Intterface test: nsobject {@ publicint I; Int J; @ protectedfloat m; float N; @ privatedouble X; Double Y ;}
@ Protected: The instance variables modified with this command can be directly accessed by this class and any subclass. This is the default situation.
@ Private: The instance variables modified with this command can be directly accessed by the methods defined in this class, but cannot be accessed directly by the methods defined in the quilt class.
@ Public: The instance variables modified with this command can be directly accessed by methods in this class, or by methods defined by other classes.
Note: in actual use, we cannot directly access the attribute of @ private permission, but testProgramYes, it can be correctly executed, but xcode will give a warning.