OC self Class & super class的
2016-12-29 本文已影响64人
哔哩哔哩智能喵
#import "Person.h"
@implementation Person
-(void)test
{
/**
[self class] 获取当前方法的调用类
[self superclass] 获取当前方法调用者的父类
super 只是一个编译提示器,并不是一个指针
只要编译器看到super这个标志,就会让当前对象去调用父类的方法,本质还是在当前对象调用
*/
NSLog(@"%@ %@ %@ %@",[self class],[self superclass],[super class],[super superclass]);//Person NSObject Person NSObject
}
@end