Topic: cCtor - comment


Author: Olaf Luethje <luethje@ert.rwth-aachen.de>
Date: 1999/06/04
Raw View
This is a multi-part message in MIME format.
--------------7419A2A4D18311E4930B19F2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

MartinR wrote:

> Why is the cCtor not involved in coversion-processes like
> all one-argument Ctor's?

The cCtor takes an argument of its own type. Since there is no
reason to convert an object to its own type, the cCtor is never
involved in conversion processes.

Don't confuse cCtor and Operator= . Ctors (including cCtors)
are only used when a new instance is created (may be temporary).
In particular cCtor is used to initialize (not assign!) a newly created
instance with an instance of the same type. Operator= is only called
for existing instances.

--------------7419A2A4D18311E4930B19F2
Content-Type: text/x-vcard; charset=us-ascii;
 name="luethje.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Olaf Luethje
Content-Disposition: attachment;
 filename="luethje.vcf"

begin:vcard
n:L|thje;Olaf
tel;fax:+49 - 241 - 8888195
tel;home:+49 - 241 - 5153509
tel;work:+49 - 241 - 80 7887
x-mozilla-html:TRUE
org:RWTH Aachen, ISS - 611810
version:2.1
email;internet:luethje@ert.rwth-aachen.de
title:Dipl.-Ing.
adr;quoted-printable:;;ISS-611810=0D=0ATemplergraben 55;Aachen;;52056;Germany
x-mozilla-cpt:;17984
fn:Olaf L|thje
end:vcard

--------------7419A2A4D18311E4930B19F2--
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "MartinR" <knot.here@[spam]usa.net>
Date: 1999/05/28
Raw View
Why is the cCtor not involved in coversion-processes like
all one-argument Ctor's?
We have explicit to avoid casting through Ctor's.
Instead of overloading operator = we could use the cCtor
in the same way and if operator = is overloaded it could
take precedence of the cCtor.

Respond to first line with the rest in mind.

Regards
/Martin
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]