Object.factory and default constructor

Cherry cherry at dream.land
Fri Feb 14 04:53:54 PST 2014


The code below throws assertion failure. Documentation for 
Object.factory says that factory can create an object if the 
default constructor is present.

So the question is -- Does D not consider this(int x=0); a 
default constructor?


module test;
class Bar {
   this(int x=0) {}
}
void main() {
   assert(Object.factory("test.Bar") !is null);
}

// Regards
// Cherry


More information about the Digitalmars-d mailing list