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

前端 未结 8 1174
鱼传尺愫
鱼传尺愫 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:15

    Self = [super init];

    According to JAVA, this mean a pointer to instance itself so object can message itself.

    Same meainng of Self here in objective C,

    According to JAVA, Super mean that allow to access base or parent class

    Same meainng of Super here in objective C,

    Now init instance to to complete the initialization process.

提交回复
热议问题