Possible Duplicate:
What's the ampersand for when used after class name like ostream& operator <<(…)?
I am new to C++ and I have probably a very noobish question. I have seen a thing like this:
Vector3f & operator = (Vector3f & obj)
{
_item[0] = obj[0];
_item[1] = obj[1];
_item[2] = obj[2];
return *this;
}
And I was wondering why is there an ampersand (&) after Vector3f. What kind of magic is it doing? I couldn't find any explanations anywhere. Most importantly, what is the difference between the thing above and
Vector3f operator = (Vector3f obj)
{
_item[0] = obj[0];
_item[1] = obj[1];
_item[2] = obj[2];
return *this;
}