Syntactic Sugar for Virtual Constructors?

Janice Caron caron800 at googlemail.com
Thu Feb 28 23:20:19 PST 2008


On 29/02/2008, Christopher Wright <dhasenan at gmail.com> wrote:

>  class Derived : AbstractBaseClass
>  {
>     static this ()
>     {
>        builders["whatever"] = { return new Derived1(); };
>     }
>  }

Again, that would require the factory function to have compile-time
knowledge of derived classes, which is precisely the thing to avoid.



More information about the Digitalmars-d mailing list