From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Calling constructors Date: 24 Apr 2003 12:22:55 GMT Organization: Aachen University of Technology (RWTH) Lines: 28 Message-ID: References: <422D62CDE87D144687C60CEC7419AD42048A68 AT sgkms01 DOT uk DOT perrymail DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1051186975 1381 137.226.32.75 (24 Apr 2003 12:22:55 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 24 Apr 2003 12:22:55 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Ellingworth, Richard wrote: > I *have* tried it with the DJGPP compiler and it doesn't tell me anything. > It compiles and links just fine but then fails to work properly. Define "work properly"... the code you showed does nothing at all, so it cannot do anything properly, either. Off-hand, I'd suspect that calling the (int) constructor in the (void) one builds a new instance of the object which is immediately discarded, but doesn't initialize the actual object you're trying to construct at all. You may have to delegate all the actual work to a pseudo constructor that all the "real constructors" call by its actual method name. Or just use default arguments and initializer lists, as god intended. > What I am interested in is why this is the case. Do you know why? My > text book certainly doesn't tell me (C++ Complete Reference 4th > edition, Herbert Schildt). As a rule of thumb: never believe a single word you find in any book with the name Schildt on it anywhere, unless it's a quote from somebody else's work. This guy is a world-famous anti-expert --- he explains things very lucidly, but the facts he explains are almost all completely wrong. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.