Inherited constructor

Andy Valencia dont at spam.me
Fri Jul 25 03:57:34 UTC 2025


On Friday, 25 July 2025 at 02:40:35 UTC, H. S. Teoh wrote:

> In D, constructors are not inherited, so yes, unfortunately you 
> have to write a forwarding ctor that passes the arguments along 
> to the base class.

My OO worldview goes back to Smalltalk, where constructors are 
"just" methods and thus you can reason about them as you would 
any other inherited method.  I see the point of nudging explicit 
treatment of superclass constructors.  Is it nannying?  A bit.  
Nothing that would make me walk away from D.  And I appreciate 
this extra insight into how D looks at constructors.

Thank you--both of you!
Andy



More information about the Digitalmars-d-learn mailing list