Edit. Actually, while what I say in my first answer is valid, this is the real reason.:
In the beginning there was C. C is not object-oriented (you can take an OO approach, but it doesn't help you or enforce anything).
Then there was C With Classes, that was later renamed C++. C++ is object-oriented, and therefore encourages encapsulation, and ensuring an object's invariant - upon construction and at the beginning and end of any method, the object is in a valid state.
The natural thing to do with this, is to enforce that a class must always have a constructor to ensure it starts in a valid state - if the constructor doesn't have to do anything to ensure this, then the empty constructor will document this fact.
But a goal with C++ was to be compatible with C to the point that as much as possible, all valid C programs were also valid C++ programs (no longer as active a goal, and the evolution of C separate to C++ means it no longer holds).
One effect of this was the duplication in functionality between struct
and class
. The former doing things the C way (everything public by default) and the latter doing things in a good OO way (everything private by default, developer actively makes public what they want public).
Another is that in order for a C struct
, which couldn't have a constructor because C doesn't have constructors, to be valid in C++, then there had to be a meaning for this to the C++ way of looking at it. And so, while not having a constructor would go against the OO practice of actively ensuring an invariant, C++ took this to mean that there was a default parameterless constructor that acted like it had an empty body.
All C structs
were now valid C++ structs
, (which meant they were the same as C++ classes
with everything - members and inheritance - public) treated from the outside as if it had a single, parameterless constructor.
If however you did put a constructor in a class
or struct
, then you were doing things the C++/OO way rather than the C way, and there was no need for a default constructor.
Since it served as a shorthand, people kept using it even when compatibility wasn't possible otherwise (it used other C++ features not in C).
Hence when Java came along (based on C++ in many ways) and later C# (based on C++ and Java in different ways), they kept this approach as something coders may already be used to.
Stroustrup writes about this in his The C++ Programming Language and even more so, with more focus upon the "whys" of the language in The Design and Evolution of C++.
=== Original Answer ===
Let's say this didn't happen.
Let's say I don't want a parameterless constructor, because I can't put my class into a meaningful state without one. Indeed, this is something that can happen with struct
in C# (but if you can't make meaningful use of an all-zeros-and-nulls struct
in C# you're at best using a non-publicly-visible optimisation, and otherwise have a design flaw in using struct
).
To make my class able to protect its invariants, I need a special removeDefaultConstructor
keyword. At the very least, I'd need to create a private parameterless constructor to make sure no calling code calls the default.
Which complicates the language some more. Better not to do it.
In all, it's best not to think of adding a constructor as removing the default, better to think of having no constructor at all as syntactic sugar for adding a parameterless constructor that doesn't do anything.