inheriting constructos
Ary Borenszweig
ary at esperanto.org.ar
Mon Nov 30 01:38:10 PST 2009
Andrei Alexandrescu wrote:
> Walter and I just discussed the matter of inheriting constructors. Our
> thought on the issue:
>
> a) If a class doesn't define any constructors and adds no fields,
> inherit constructors. Example:
>
> class MyException : Exception {}
>
> b) If a class defines at least one constructor, do not inherit
> constructors.
>
> c) If a class doesn't define any constructors but does add at least a
> non-static field -> undecided.
>
> What do you think?
I like this. I think c should be a compile-time error.
Here's another use for annotations, in case you define new fields but
still want to inherit the constructors:
@InheritConstructors
class Foo : Bar {
}
More information about the Digitalmars-d
mailing list