2015-06-14 78 views
4

我有一个扩展Iterable(以及其他接口)的接口。扩展Iterable的Haxe接口

interface MyInterface extends Iterable { 
    public function iterator():Iterator<Dynamic>; 
} 

这给了我

MyInterface.hx:1:1-3行:为 可迭代

什么是进行正确的方式无效数量的类型参数?

+0

这是哪一种语言? –

+1

这是Haxe(http://haxe.org/)。 – Gama11

回答

7

Iterable被定义为typedef而不是interface,所以这是行不通的。

只需将名为iterator()的函数添加到您的类中就可以实现,无需实现或扩展任何内容。有关于迭代器on the Haxe Manual的更多信息。