DM>Now, in practical terms, this means that there are two types of
DM>default constructors: - those with no actual arguments, and -
DM>those with all default arguments.
TH>Incorrect.
TH>There is only one default constructor - no arguments. It doesnt even
DM>You seem to be misinterpreting what I said. We're talking about
DM>how it looks to the new C++ programmer
Hi Darin;
Maybe the discussion *should* be about how it looks to the developers
of C++, namely Benjemin what's his name. [grin]
DM>- in particular, how it looks(looked) to Rene. There are a lot of
DM>concepts in following the two "types" that need to be ironed out.
Yes, and it is important to get those concepts in correct
*perspective* and accurately defined. There are certain rules no
matter what level of programming one is at. And in C++ one of the
rules is that there is only *one* _default_ constructor, no
arguments, no returns. All other constructors are there to provide
the desired functionality.
DM>Since most C++ programmers have come from other languages, they
DM>may not be used to the two concepts required here: overloading and
DM>default arguments.
True, overloading is an uncommon but nifty feature. But not default
arguments - which, BTW, are not the same thing as a default
constructor. Default arguments (or parameters, more correctly) can
exist in *any* function whether it's a method to a class or not. A
default constructor *must* exist in every class. If it is not
specified (ie. one that takes no arguments), then the compiler will
create one - behind the programmers back.
DM>The easy default constructor to understand, the one that is coded
DM>such that it cannot take arguments, is best seperated conceptually
DM>from the more difficult one until the student can understand the
DM>concepts enough to unite them again.
Default constructors don't take arguments - never.
Try it. Create a class with *one* constructor having one or more
parameters. Specify an instance with no arguments. You will find that
it both compiles *and* runs. Reason, the default constructor that was
ommitted from the code was created by the compiler.
DM>JMNSHO.
???
I'm not up on this acronym. [grin]
cya around, friend.
___ Blue Wave/QWK v2.12
--- Maximus/2 3.01
---------------
* Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88)
|