开发者

Explanation of declaration: id<a_name> delegate;

开发者 https://www.devze.com 2023-04-11 06:58 出处:网络
I 开发者_开发技巧am learning Objective-C and I would like to know what the meaning and the purpose of the following declaration is:

I 开发者_开发技巧am learning Objective-C and I would like to know what the meaning and the purpose of the following declaration is:

   id<A_specific_name> delegate;


This means delegate is a variable that has the general type id and it conforms to A_specific_name protocol.

id is typedef on void *, and a protocol is a concept similar (but not the same exactly) to Java interfaces.


It is an object conform to "A_specific_name" protocol (interface)

You can read Apple doc on objective-C

0

精彩评论

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