---------------------------------myCategory文件----------------------------
///myCategory.h
-(void) callFromNSObject;
@end
/myCategory.m
@implementation NSObject(myCategory)
-(void) callFromNSObject
{
NSLog(@"i am NSObject functions");
}
@end
---------------------------------dog文件----------------------------
/dog.h//
@interface dog :NSObject
-(void) init;
@end
dog.m///
@implementation dog
-(void) init{};
---------------------------------person文件----------------------------
person.h///
@interface person:NSObject
{
dog* mydog;
}
-(void) call;
@end
person.m///
@implementation person
-(void) call{
[mydog callFromNSObject];
}
--------------------------------main文件----------------------------
///main
int main(int argc,const char* argv[])
{
person* p = [[person alloc]init];
[p call];
return 0;
}