Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've read the documentation but I'm still confused. Can someone please explain what a protocol is? (You could give code examples but I'm really looking for an explanation)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
342 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here's a great article on it. Effectively, a protocol in Objective-C is very similar to an interface in Java or a pure virtual class in C++ (although not exactly as pure virtual classes can have data members...). It's basically a guarantee that a specific class knows how to respond to a given set of methods (messages).

Edit The original article disappeared so I have replaced it with a different tutorial.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...