Classification:
The main is to add some methods to the original class; You cannot add member variables
Person (person+eat)
Informal agreements:
The informal agreement is the category, that is, the category that is added to the class in the framework of NSObject or its sub-class foundation, is an unjust agreement
Write a category to NSObject, NSObject class name (EAT), NSObject subclasses can inherit the method inside
Classification (category) extension
Extended categories are also called Extensions of classes:
@interface person Category (empty)//class extension
{
You can add properties
int _age;
}
Expansion methods
-(void) eat; A relative private method
@end
cannot be implemented in @implementation person () @end
Implemented directly in the @implementation person @end
OBJECTIVE-C (category classification, informal agreement, classification extension)