Inherited constructor

Brother Bill brotherbill at mail.com
Fri Jul 25 18:45:31 UTC 2025


On Friday, 25 July 2025 at 03:57:34 UTC, Andy Valencia wrote:
> 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

In Eiffel, constructors are also "just" methods, which are added 
to "create" section to be elevated to constructor status.


More information about the Digitalmars-d-learn mailing list