[haXe] passing Class as argument

Nicolas Cannasse ncannasse at motion-twin.com
Tue Apr 25 16:59:46 CEST 2006


> I have a class MyClass, if I try to pass it as argument (the class not
> an instance) in this way:

> I obtain a compilation error: #MyClass has no field __construct__

Yes that's because "MyClass" currently does not have the type Class.
Try to use Dynamic right now.

> Just another question, using reflection does exist a way to obtain the
> fields of an instance without instantiating it?

Yes, you can check the null fields in MyClass.prototype by using
Reflect.fields.

Nicolas





More information about the Haxe mailing list