[super xxx] calls the super method on the current instance (i.e. self).
[super xxx] ,表示接收xxx消息的對象是self港柜,但是xxx方法的實(shí)現(xiàn)是super的请契。
http://stackoverflow.com/questions/11827720/why-does-self-class-super-class
一個(gè)網(wǎng)上很有名的面試題:下面的代碼輸出結(jié)果是什么?
@implementation Son : Father
- (id)init
{
self = [super init];
if (self)
{
NSLog(@"%@", NSStringFromClass([self class]));
NSLog(@"%@", NSStringFromClass([super class]));
}
return self;
}
@end
// 答:都是son夏醉。