constructor inheritance

Simen Kjaeraas simen.kjaras at gmail.com
Tue Mar 4 14:35:05 PST 2008


On Tue, 04 Mar 2008 22:25:15 +0100, Robert Fraser  
<fraserofthenight at gmail.com> wrote:
> How about just:
>
> class Child : Parent
> {
>      this(int x, int y)
>      {
>          super(x, y);
>          // Do anything else here if you want
>      }
> }

That does of course work, but if you have 15 different constructors, and  
most of them are identical to those of the base class, the template mixin  
is simpler and cleaner.

-- Simen



More information about the Digitalmars-d mailing list