Subject: return *this - Chap 8 pg 418
Posted By: proslambano Post Date: 3/10/2007 12:19:55 PM
in "Overloading the Assignment Operator" page 418 at the bottom, the example member function returns "* this".

At the top of pg 419, Ivor says that we return a reference with this statement.  

I'm a little confused.  My understanding is that "this" is a pointer (to the object calling the function).  So, if I use, "* this" am I de-referencing the this pointer, and therefore passing an "object" back?

VC++ help document, ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vclang/html/92e3256a-4ad9-4d46-8be1-d77fad90791f.htm
says
The expression *this is commonly used to return the current object from a member function:

return *this;




Sincerely,
Brian

Go to topic 57524

Return to index page 5
Return to index page 4
Return to index page 3
Return to index page 2
Return to index page 1