June 21st, 2009, 10:13 am
To the OP:You are correct that *this deferences the this variable to fetch an object of type XThere are now two possibilities: 1) A copy of the type X object can be returned. In this case, your code would change slightly. Line 1 would read X X::memberfunctionofX()2) The actual type X object can be returned with no copying. That is the case in the code you wrote. "Returning an actual object without copying" is just a non-jargon way of saying "returning a reference".You are also correct that the code you present is more common than writing X X::memberfunctionofX() One reason is that, in your code you can write stuff likex.memberfunctionofX() = ...; You can't do this without using a reference.It is unclear (to me) why you use the term "overloading" in your post. This concept does not appear anywhere in your code. Overloading means to use the same function name for two different functions. For exampleint Overloading(int x, int y){ return x + y;}int Overloading(int x){return x+1;}This is perfectly legal code despite giving the same name to two totally different functions, and this illustrates what "overloading" means. So I don't know why you mention "overloading" in your post.CommodityQuant