Object.factory() and module name

Jacob Carlborg doob at me.com
Sun Apr 28 01:41:51 PDT 2013


On Friday, 26 April 2013 at 16:13:44 UTC, Luís Marques wrote:
> BTW, I was working on a Object.factory scenario right now (!) 
> and stumbled on the limitation that the class can only have a 
> default constructor. Couldn't you call a non-default 
> constructor by passing var args to Object.factory()?

Have a look at this:

https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L174

It won't call the constructor but it will create a new instance 
even if its construct takes arguments. You can probably call the 
construct using something like:

instance.__ctor(args);

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list