0

Possible Duplicate:
What is the difference between a protocol and a interface?

What is differences between @protocol and @interface in Objective-C?

I'm confused on figuring out diffences between two. It looks like similar to me. Am I wrong?

Please, don't compare with java interface. I just want to know @interface and @protocol in Objective-c

Community
  • 1
  • 1
user1433078
  • 49
  • 1
  • 4
  • protocol is interface in Java, @interface is where the variable and method declaration goes to – Bryan Chen Jun 03 '12 at 10:10
  • Similar questions: http://stackoverflow.com/questions/2818208/what-is-the-difference-between-a-protocol-and-a-interface http://stackoverflow.com/questions/990360/differences-between-java-interfaces-and-objective-c-protocols http://stackoverflow.com/questions/1375617/objective-c-interfaces-delegates-and-protocols-oh-my – Omar Abdelhafith Jun 03 '12 at 10:13

2 Answers2

0

As far as I know, @interface is the interface of a class, like the things you put in the header file in C++. @protocol, on the other hand, is much more like a "real" interface, it serves a similar purpose as the interfaces in Java or .Net.

Your downvotes will come from the fact that this is a quite basic aspect of Objective-C that you could find in any book or tutorial.

Vincent
  • 1,027
  • 1
  • 11
  • 20
0

@protocol is used for delegate, and @interface is for the class self. delegatee use the methods in @protocol without implementing it because delegator will. But it has to implement everything in @interface.

Kyle Fang
  • 1,139
  • 6
  • 14