Anonymous classes should pass through super ctors

Sean Kelly sean at invisibleduck.org
Mon Aug 18 12:12:21 PDT 2008


Frank Benoit wrote:
> Anonymous classes should pass through super ctors, if no ctor is given.
> 
> class C {
>    this( int i ){ .... }
>    abstract void run();
>    // ...
> }
> 
> auto c = new class(3) C {
>    this( int a ){ super(a); } //<-- this line should not be necessary.
>    void run(){}
> };

I'd argue that ctors should always be inherited if no ctor is defined, 
much like the regular function lookup rules for classes.  In fact, I 
posted a proposal regarding this maybe a year ago, but I'm too lazy to 
go looking for it now.


Sean



More information about the Digitalmars-d mailing list