ctor not inhrited in a classes

Zaher Dirkey zaherdirkey at yahoo.com
Mon Jun 17 20:20:19 UTC 2019


On Sunday, 16 June 2019 at 20:43:05 UTC, Basile B. wrote:
> On Sunday, 16 June 2019 at 14:11:15 UTC, Zaher Dirkey wrote:
>
> There was a DIP proposing better inhertence of constructors. 
> Unfortunately it's been dropped : 
> https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1004.md
> Meaning that someone need to replace the original author(s).
>
> Maybe something based on mixin can help in your case, even if 
> that's not clean IMO.

After looked at the example, Now I understand why they go with 
mixin as a solution,
in c++11

struct D : B
{
     using B::B; // inherit constructors from B
};

Here we inherited the ctor by modifiing derived class (subclass) 
not superclass,
mixin will do the same, and that not a good solution, Why i need 
i dont want to modify sub classes to inherite ctor, We need to 
make ctor already inherited to all subclasses and subsubclases, 
and stop compiling if there is no right parameters passed to it.

While I am a newbie in D (I think i will be stay newbie) not sure 
if a feature request acceptable from me.

mayb adding new feature like @disable, but somting @inherite (or 
better attrubute) to the ctor

  class SuperClass {
      @inhrite this(int x){

      }
  }

not this ctor will apply to all subclasses and blew sub sub 
classes.

my question: if there is a magic trick in D to do that, i know D 
have amazing magics.


More information about the Digitalmars-d mailing list