什么是C#接口和一个Objective-C协议之间的区别? [英] What's the difference between an C# Interface and an Objective-C Protocol?

查看:111
本文介绍了什么是C#接口和一个Objective-C协议之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么一个C#接口和一个Objective-C协议之间的区别?我问,因为我是在深入ASP.NET MVC和我试图抓住一些新的概念,它会帮助,如果我可以将它们与我的Objective-C编程的iOS背景。

What's the difference between a C# Interface and an Objective-C Protocol? I ask because I'm diving into ASP.NET MVC and I'm trying to grasp some of the new concepts and it will help if I can relate them to my Objective-C iOS programming background.

感谢您的帮助!

推荐答案

,他们基本上是相同的。在Objective-C 2.0,不过,你可以标记在协议的一些方法,可选(使用 @optional 预选赛),这意味着,实施该协议的类AREN 'T需要实现这些方法。

They're basically the same. In Objective-C 2.0, though, you can mark some methods in a protocol as "optional" (using the @optional qualifier), which means that classes that implement the protocol aren't required to implement those methods.

这篇关于什么是C#接口和一个Objective-C协议之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆