Mail Archives: djgpp/2003/04/24/07:30:06
Ellingworth, Richard <Richard DOT Ellingworth AT uk DOT perrymail DOT com> 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.
- Raw text -