Sorry, I don't understand how this can be an answer to my question.
I can always take charge. But why is the default constructor provided
by the compiler disabled if I define any other constructor that takes
an argument? I can't see any obvious reason for this.
Is it because it is easier to write a compiler? Does anybody know?
There are a lot of times when you do not want a class to have a default
constructor.
For example, say you have a class representing a connection to a
database. Say you decide that it does not make sense for there to be a
"default" constructor which represents a connection; sometimes you need
to have clients of you class to explicitly state what the connection is
when clients create an instance of the class. Forbidding default
constructors forces the clients of a class to fully initialize an object
when the object is created. It prevents clients from "partially"
initializing objects before using them.
If C++ always created a default constructor, C++ would need some kind of
syntax for programmers to tell the compiler not to create a default
constuctor. Essentially, designers of a class would have to declare the
default constructor as private in the class definition. The authors of
the language saw that programmers would frequently forget to explicitly
declare the default constructor (or more exactly, the constructor which
takes no arguments) as private, so they decided that if one user-defined
constructor exists, it makes more sense to not automatically generate any
other constructors.