什么是objective-c中的协议

jal*_*eel 0 protocols interface objective-c

可能重复:
什么是协议

如何在Objective-c中使用协议?它的优点是什么?

感谢和问候+

Cam*_*ert 7

Protocols have many advantages. The idea is to provide a way for classes to share the same method and property declarations without inheriting them from a common ancestor. This is especially useful in Objective-C when using the delegation pattern, on which the iOS and Mac OS SDKs rely heavily. There's plenty of information out there on the subject, including a good overview in Apple's developer documentation.