Reputation: 986
I want to do these in a util class for all classes which have position and size
class Creator<T> {
public function create() {
…
var object = new T(); // compile error: T is a compile time class or something (?)
object.x = x_; // compile error: T doesn't have an x properties
…
}
}
Upvotes: 1
Views: 154
Reputation: 544
I recommend you to read the Haxe manual. The part you are interested on is how Haxe manages the Type parameters here and how to apply Constraints to them here. Once you have read that, the way you can achieve it is similar to this.
Upvotes: 2