开发者

Declaring delegate

开发者 https://www.devze.com 2023-01-05 15:55 出处:网络
Just realized that the delegates I am declaring are not declared with pointer type. so instead of this

Just realized that the delegates I am declaring are not declared with pointer type.

so instead of this

id <AddViewControllerDelegate> *delegate;

I have this

id <AddViewControllerDelegate> delegate;
开发者_运维百科

Why the last way is correct? Since self is pointer(I guess) then why delegate is not?


'id' is already a pointer type. It's just hidden behind the typedef.

typedef id          (*IMP)(id, SEL, ...); 
typedef struct objc_class *Class;
typedef struct objc_object {
    Class isa;
} *id;


id is actually a pointer to an object.

0

精彩评论

暂无评论...
验证码 换一张
取 消