From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Calling constructors Date: 24 Apr 2003 11:20:24 GMT Organization: Aachen University of Technology (RWTH) Lines: 27 Message-ID: References: <422D62CDE87D144687C60CEC7419AD42048A67 AT sgkms01 DOT uk DOT perrymail DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1051183224 26322 137.226.32.75 (24 Apr 2003 11:20:24 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 24 Apr 2003 11:20:24 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: > Hello. Sorry if this is a bit off-topic, but I have a C++ related question. > Is it OK to call constructors directly? For example, can you do this? : Why ask here? You could just try it out, and see what the compiler tells you. You'ld have the answer in a lot less time. Anyway: this is an issue about the C++ programming language, not about DJGPP, so you had better ask such questions elsewhere. Over in comp.lang.c++, to name only the most obvious choice. > class MyClass { > public: > MyClass( void ) > { > MyClass( 0 ); > } For a case like this, it's not even necessary to do it. If you search a little in your C++ textbook, you'll learn about default arguments values, which you can use to avoid even *having* the no-argument constructor in this case. Go figure. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.