Sunday, April 3, 2011

Protocol in Objective C

Protocol in Objective C is quite similar to interface in java or .net, so there is not much to say about it.

To define a protocol in a class header as
@protocol MyProtocol
-(void) myfunction;
@end

The header file of the class that implements a protocol looks like the following, notice the syntax is quite similar to category but uses angle bracket instead of parenthesis.

@interface MyUserClass : NSObject .

Jonathan

No comments:

Post a Comment