class:
获取方法调用类名
superclass:
获取方法调用者的父类类名
super:
编译修饰符
,
不是指针
,
指向父类标志
,
本质还是拿到当前对象去调用父类的方法
注意
:super
并不是拿到父类对象去调用父类方法
Person.h
@interface
Person :
NSObject
- (void)test;
@end
Person.m
- (
void
)test
{
// self:SonPerson
// SonPerson Person self:SonPerson
NSLog( @"%@ %@ %@" ,[ self class],[ self superclass],[ super class]);
NSLog( @"%@ %@ %@" ,[ self class],[ self superclass],[ super class]);
}
SonPerson.h
@interface
SonPerson :
Person
@end
SonPerson.m
- (
void
)test
{
// SonPerson Person SonPerson
NSLog(
@"%@ %@ %@"
,[
self
class],[
self
superclass],[
super
class]);
[ super test];
[ super test];
}
ViewController.h
- (
void
)viewDidLoad {
[ super viewDidLoad];
[ super viewDidLoad];
SonPerson
*son = [[
SonPerson
alloc] init];
[son
test
];
}