typeof(this) and subclasses

Serg Kovrov kovrov at no.spam
Sat Aug 12 14:02:41 PDT 2006


Forgot to mention, currently as workaround I use templates:
T Create(T)()
{
   // ... some init code
   return new T(init_result);
}

auto f = Create!(Foo)();    // f is instance of Foo
auto b = Create!(FooBar)(); // b is instance of FooBar

But `FooBar.create()` me like much better =)

-- 
serg.



More information about the Digitalmars-d-learn mailing list