constructor inheritance

Elwis elwispl at gmail.com
Tue Mar 4 12:59:35 PST 2008


Ary Borenszweig Wrote:

> Elwis wrote:
> > I might have described my problem unclearly.
> > 
> > I has root class and it has some constructor. One of those just calls one of its methods. I'd like not to copy declaration of this constructor in all of its children.
> 
> Do you mean you don't want to have to do this?
> 
> class Parent {
> 
>    this(int x, int y) {
>      // some code
>    }
> 
> }
> 
> class Child : Parent {
> 
>    // I wish the compiler would add the this(int x, int y) constructor
>    // automatically for me here
> 
> }

It doesn't work. Maybe it isn't supported by GDC?



More information about the Digitalmars-d mailing list