Constructor inheritance? Why not?

Kapps via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 8 09:38:45 PDT 2015


On Monday, 8 June 2015 at 02:39:22 UTC, Tofu Ninja wrote:
> Is there any reason why constructors are not inherited? All 
> other methods are inherited, why not constructors?

It should be relatively easy to do this with a mixin in theory. 
Or even a CtorArgsTuple, allowing something like (not certain if 
this would work):
this(CtorArgsTuple!super args, bool animated) {
     super(args);
     this.animated = animated;
}
Also not sure if the '!super' would work as opposed to specifying 
the type.

This approach has the issue of not inheriting documentation 
though, which annoys me.


More information about the Digitalmars-d mailing list