开发者

Declaring delegate

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜