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
精彩评论