Objective-c: Questions about self = [super init]

前端 未结 8 1175
鱼传尺愫
鱼传尺愫 2020-12-12 23:01


I have seen self = [super init] in init methods. I don\'t understand why. Wouldn\'t [super init] return the superclass? And if we point

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 23:27

    [super init] is the same as [self superclass_variant_of_init]

    If you want to send a message to superclass, there is another approach (without using runtime library):

    [[self superclass] init];
    

提交回复
热议问题