vecteur& vecteur::operator+=(const vecteur& autre)
{
x += autre.x;
y += autre.y;
z += autre.z;
return *this;
}
What does *this
mean in that case?
Is there any possibility to call it differently, like simply return vecteur
?
vecteur& vecteur::operator+=(const vecteur& autre)
{
x += autre.x;
y += autre.y;
z += autre.z;
return *this;
}
What does *this
mean in that case?
Is there any possibility to call it differently, like simply return vecteur
?
this
is a pointer to the object that the method is being called on. *this
is that pointer being dereferenced (i.e. accessing the actual object itself).