How to look for a class type in an array using generics
问题 I'd like to look for a specific class type into an array. No clue how. var a:A = new A(); var b:B = new B(); // B extends A var c:C = new C(); // C extends A var arr:Array<A> = []; arr.push(a); arr.push(b); arr.push(c); // i'd like something like: c = arr.get<C>(); 回答1: In Haxe, like Java, you can't get access to the type parameter inside the code, since in most implementations it is erased, meaning the same as "Dynamic". This means that in order to implement that, you'd need a function like