扩展Iterable的Haxe接口
问题描述:
我有一个扩展Iterable(以及其他接口)的接口。扩展Iterable的Haxe接口
interface MyInterface extends Iterable {
public function iterator():Iterator<Dynamic>;
}
这给了我
MyInterface.hx:1:1-3行:为 可迭代
什么是进行正确的方式无效数量的类型参数?
答
Iterable
被定义为typedef
而不是interface
,所以这是行不通的。
只需将名为iterator()
的函数添加到您的类中就可以实现,无需实现或扩展任何内容。有关于迭代器on the Haxe Manual的更多信息。
这是哪一种语言? –
这是Haxe(http://haxe.org/)。 – Gama11