Mail Archives: djgpp/1999/10/02/14:57:53
"Wendy E. McCaughrin" wrote:
>
> 2 questions:
>
> 1. Your reference for the above assertion?
[1] Bjarne Stroustrup, The C++ Programming Language, 3rd. ed.,
Addison-Wesley, Reading, MA, 1997, p. 145, ll.(-12)--(-11).
> 2. You say that the new object is merely constructed at the place
> where temp is allocated -- how is this different from bit-wise
> copy? By "construct" do you mean the char* ctor is invoked to
> build 'temp' -- then I agree it is not bit-wise copy. But you
> express it like assignment, which defaults to bit-wise copy.
I goofed on the second temp. I should have written:
TstCpy(Overflow(" I an a temporary\n"));
is akin to
Overflow temp(" I an a temporary\n");
which does not invoke the copy constructor, but invokes the constructor
to construct temp directly on the stack of TstCpy().
BTW. You can see the constructor being called by either inserting a
debugging "cout <<" inside the constructor, or by stepping through the
code with gdb.
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
- Raw text -