alias to connect with superclass's constructor

Ali Çehreli acehreli at yahoo.com
Sat Mar 22 12:05:11 UTC 2025


On 3/21/25 8:35 PM, Andy Valencia wrote:

 > tst39.d(21):        add `alias this = tst39.A.this` to `tst39.B`'s body
 > to merge the overload sets

Yeah, that doesn't work. Perhaps a regression...

 > I _can_ add this to B:
 >
 > ```d
 >      this() {
 >          super():
 >      }
 > ```

And then it's more meaningful to me for the other constructor to call 
this() instead of super() directly:

     this(string s) {
         this();
         this.b = s;
     }

Ali



More information about the Digitalmars-d-learn mailing list