Small suggestion for default constructors

JN 666total at wp.pl
Tue Jan 17 10:36:50 UTC 2023


On Tuesday, 17 January 2023 at 02:45:30 UTC, TheZipCreator wrote:
> I feel like this would avoid a lot of boilerplate and make 
> things more concise.

Yeah, it's something I miss greatly from D (named constructors 
are another feature I miss). In Dart you can do it like this:

     class Point
     {
         num x;
         num y;

         Point(this.x, this.y);
     }

     var p = Point(10.0, 20.0);


More information about the Digitalmars-d mailing list