tonytran
tonytran

Reputation: 1078

Explanation of declaration: id<a_name> delegate;

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;

Upvotes: 0

Views: 76

Answers (2)

user971401
user971401

Reputation:

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.

Upvotes: 1

Beno&#238;t
Beno&#238;t

Reputation: 7427

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

You can read Apple doc on objective-C

Upvotes: 0

Related Questions