thanks for pointing that out ToniT..
some more questions that maybe you , or someone else might be able to clarify for me <?>
i compiled your code three times (using the first example you gave me)..the first time i got this output:
Normal constructor called.
Calling func..
Normal constructor called.
Assignment operator called.
Calling func2..
Copy constructor called.
Done.
..the second time, i recompiled with '-Wall' and it cried about not having a return statement for the copy assignment op.. so i added 'return *this;' and recompiled with the warnings and it went fine...however my output had changed to this::
Normal constructor called.
Calling func..
Normal constructor called.
Assignment operator called.
Copy constructor called. <-- this was added
Calling func2..
Copy constructor called.
Done.
...now i recompiled with debugging info (-ggdb) and ran it through anjuta-1.1.97 and i noticed something rather odd...
--- taken from my post on codewarrioru.com ---
i ran this through a debugger, using anjuta, and i noticed something peculiar ...something that isn't shown in the output...
when i reach the line 'x=funct();'
it creates 'ob2' using the standard constructor. then it jumps to the closing brace in funct(), and immediatley jumps to the assignment op, then to the copy constructor...what strikes me as odd is that it then jumps back to the assignment op , but it doesn't display any output from *that* jump , it goes right to the 'cout' after the function call is completed and everthing is *copied*??
so theoretically what should've been shown according to what i just said would be ::
Normal constructor called.
Calling func..
Normal constructor called.
Assignment operator called.
Copy constructor called. <-- mine is here though
..hmmm...
Assignment operator called. <-- according to what i witnessed in the debugger ...this should show up again ??
Calling func2..
Copy constructor called.
Done.
does anyone have any thoughts on this
thanks alot,
jeremy