Sep 30, 2016 at 10:42pm UTC
i copied a lot of code for practice and i come up with this problem.
why is the purpose of the "&" next to the first vec3 i deleted it and still works and know what does & but i dont figure out what is hes purpose here.
the function is returning the memory address of the current object why put & there
[code]i only put this part because is a lot of code.
in vec3.cpp:
vec3"&"vec3::Divide(const vec3 & other)
{
x /= other.x;
y /= other.y;
z /= other.z;
return *this;
}
in vec3.h:
vec3"&"Divide(const vec3 & other);
Sep 30, 2016 at 10:53pm UTC
The &
can be three different things, depending on where it is:
* operator AND
* "address of" -operator
* a reference
Which could it be here?
Sep 30, 2016 at 11:09pm UTC
i think it should be a reference but a reference to ??? that is what a dont understand ,
a reference to ¿¿this*??? what this means ,isnt *this the address of the current object ?