[Issue 9066] Add constructor inheritance feature

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 4 04:27:25 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=9066

--- Comment #17 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
(In reply to Martin Nowak from comment #13)
> - You can use @disable this(int) in the derived class to selectively
>   disable some of the super class constructors.

Thinking about this now, I think this specific point may be a bad idea since
the base class may be in a 3rd part library. If the authors of the base class
introduce yet another new constructor you have to be vigilant and check if you
need to add any new @disable this(...) declarations in your own subclass.

This is similar to the base class method hijacking problem
https://dlang.org/hijack.html ("Base Class Member Function Hijacking"), but it
would be a bigger problem for constructors as listed in
https://issues.dlang.org/show_bug.cgi?id=9066#c8

I'll begin working on a DIP.

--


More information about the Digitalmars-d-bugs mailing list