Delegating constructor and call to super

Mike Parker aldacron at gmail.com
Mon Jul 2 10:00:58 UTC 2018


On Monday, 2 July 2018 at 09:42:36 UTC, Robert M. Münch wrote:

>
> I think it's because of "If a constructor's code contains a 
> delegate constructor call, all possible execution paths through 
> the constructor must make exactly one delegate constructor call"
>
> But, how am I supposed to call the super(int) consturctor and 
> put my common initialization code into a delegating constructor?

class B {
	this(){ initialize(); }
	this(int a){super(a); initialize(); }
         private void initialize() { ... init some stuff for B ... 
}
}


More information about the Digitalmars-d-learn mailing list