[haXe] Q: Class with type parameter, instance variable

Zjnue Brzavi zjnue.brzavi at googlemail.com
Wed Jul 4 18:11:47 CEST 2007


Hi list,

I'm having trouble understanding why the following will not compile.

class ABase<I> {	
	public function new () {
	}
	public function execute( c : I ) {
		c.doSomething();
	}
}

class A<I> extends ABase<I> {

	private static var inst :A<I>; //A.hx:3: characters 16-31 : Class not found : I
	
	public function new() {
		super();
	}
	public static function main () {
		inst = new A<IA>();
	}
}

interface IA {
	public function doSomething();
}

Should the instance variable of class A not be accessible
through A<IA>.inst
?

Any explanations would be fantastic!

Zjnue



More information about the Haxe mailing list