I have a class like this
class Test_cs_interface {
public var exits:List<MyPlaceable>;
public function init(){
exits=new List();
exits.push(new Shelf());
}
public function my_exits():List<MyPlaceable> {
return exits;
}
}
interface MyPlaceable {
public function place():Bool;
}
class Shelf implements MyPlaceable {
public function new() {
}
public function place():Bool{
return true;
}
}
When compiling to CS haxe Test_cs_interface -cs testcs
, the field exit becomes a List, this is causing me not to be able to cast it back to a cs MyPlaceable,
public global::haxe.ds.List<object> exits;
public virtual void init() {
this.exits = new global::haxe.ds.List<object>();
this.exits.push(new global::Shelf());
}
I wonder why and how I could haxe haxe declare exits as the inteface, maybe there is some workaround to this.
Thanks for any help