Anonymous classes should pass through super ctors
BCS
ao at pathlink.com
Mon Aug 18 11:24:24 PDT 2008
Reply to Steven,
> "BCS" wrote
>
>> Reply to Bruno,
>>
>>> I don't see how this could be dangerous in any way whatsoever, if
>>> the
>>> ctor inheritance rules followed the same rules as method inheritance
>>> rules:
>>> * if you don't override or overload any ctor in the overload set,
>>> then
>>> the whole overload set is available in the child class.
>>> * if you do override or overload any ctor, well... follow the same
>>> rules
>>> as overriding/overloading a method.
>> There needs to be an easy way to forbid one, several or all base
>> constructors.
>>
> If you want to forbid all constructors, make a private constructor in
> the derived class. Due to the scope resolution rules of D, only the
> most derived class' counts, unless you alias the parent's.
>
yup
> If you want to forbid one, then you have to forbid it the same way you
> do normal methods, implement all the ones you don't want to forbid.
>
one option would be:
private this(/* the signiture *){assert(false);} // forbid this
alias this this; // get everything else
>> And while were at it, it would be nice to add an auto constructor
>> that is added to all constrictors (kind of like member variable
>> initialization in c#)
>>
> It would be nice to be able to do this with runtime constructs,
> instead of being limited to compile-time ones.
>
I'm not following...
> -Steve
>
More information about the Digitalmars-d
mailing list