1. The @ public, @ private, and @ protected defined in the class only affect the access permission of the class that inherits it.
2. @ property automatically adds the getter/setter Method to the variable.
3. getter method:
1 -(id) name
2 {
3 return name;
4 }
4. setter method:
1-(void) setname :( ID) _ name
2 {
3 if (name! = _ Name)
4 {
5 [Name Release];
6 name = [_ name copy]; // when the copy parameter is set
7}
8}
5. @ property's copy, retain, and assign Parameters
Affected setter functions:
Copy: name = [_ name copy]; // nsstring recommended
Retain: Name = [_ name retain]; // other object types are recommended.
Assign: Name = _ name; // delegate, basic data type (INT) is recommended
6. @ readonly parameter of property
Generate only getter Functions
7. @ property's atomic, nonatomic Parameter
Atomic ensures the thread security of getter and setter to a certain extent, but it cannot be completely dependent.
Nonatomic does not guarantee thread security and speed. Nonatomic is used in most cases.
8. @ property default parameters:
Atomic, assign, readwrite