Ok, I have this operator overloaded like this:
Code:
Vector3 operator + (Vector3& add);
The code works fine but my question is, if I'm returning a non reference the overloaded operator will create a new Vector3 class and than return it. Now when it returns it, does it create a replica of the temp Vector3 class and than returns that? Here is the code for the overloaded operator:
Code:
Vector3 Vector3::operator + (Vector3 &add)
{
return Vector3(x + add.x, y + add.y, z + add.z);
}
Also if I derefernece something like this: *this will it create a whole new variable of this? So if I have an operator that returns Vector& and I return the dereferenced of this, will it create a whole new this and than return a reference to it?