H
Helge Jensen
Jon said:In that case, what would you expect to happen if classes inherited
constructors and someone used the parameterless contructor inherited
(directly or indirectly) from System.Object?
One could propose a variance of default-construction that could be
claimed to be akin to "constructor-inheritance" and which makes a bit
more sense than the parameterless-default-constructor definition.
Instead of a parameterless constructor, a class will have
default-constructors corresponding to it's super-class' constructors,
all implemented by simply invoking base(...) with the arguments.
Notice that for classes with only a parameterless constructor this
yields the same semantics as now.
If *any* constructor is declared in a class, *no* default constructors
are generated, as it is now.
Also, defaulting to constructing the super-class using it's
parameterless constructor is somewhat error-prone. One could argue that
required explicit declaration of parent-construction would be "in the
spirit" of C#.
But all that's too late now, we're stuck with a default parameterless
constructor in C# -- but so are most other languages so it's not much of
a competitive parameter.