Interface/abstract constructors

Timon Gehr timon.gehr at gmx.ch
Mon May 16 12:40:39 PDT 2011


> Hey guys,
>
> is there any chance to create an abstract constructor like:
>
> abstract class ABC {
>
>    abstract this();
>
> }
>
> DMD always says "...this non-virtual functions cannot be abstract" -
> when I use an interface like:
>
> interface ABC {
>
>    this();
>
> }
>
> I get a similar error: "...constructors, destructors, postblits,
> invariants, unittests, new and delete functions are not allowed in
> interface ABC"
>
> Is there any solution or is it possible to create such inheritances
> in DMD?

How about:
abstract class ABC{
    this();
}

Timon


More information about the Digitalmars-d-learn mailing list