如何在Objective C中实现多接口?

7

我应该如何用Objective C实现以下功能(下面的示例是伪代码):

  1. 接口A继承B,C

  2. 接口A

接口B

类X实现A,B

3. 接口A

类X实现A

类Y实现A

接口B

类Z继承自Y并实现接口B

谢谢!


你的意思是 @interface 还是协议(也称为 @protocol)中的接口? - Grant Paul
1个回答

23
听起来像是作业,你应该先行动起来:http://en.wikipedia.org/wiki/Objective-C。请看2.2 Interfaces and implementations。
我的类 MyClass 继承自 Class。
 @interface MyClass : Class { }
 @end

MyClass扩展了Class并实现了Interface1和Interface2接口。

 @interface MyClass : Class <Interface1, Interface2> {}
 @end

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接