[LC++]Question about ctors and dtors

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Tue Apr 2 21:53:05 UTC 2002


> See the following code. When run, the output is only for the test()
> member. There is no output for the ctor and dtor. Why? Surely 
> an object
> of the bogus class is being created?

You didn't insert anything in there.
mv[0] returns a reference to an object (in this case, something
referencing memory after the array, which was not constructed).
It's not assigned, but used as a temporary, so the result won't
be copied (therefore no copy ctor).

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20020402/08519db0/attachment.htm 


More information about the tuxCPProgramming mailing list