[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [LC++]Question about ctors and dtors



Title: RE: [LC++]Question about ctors and dtors

> 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