I'm implementing vector class and I need to get an opposite of some vector. Is it possible to define this method using operator overloading?
Here's what I mean:
Vector2f vector1 = -vector2; Here's what I want this operator to accomplish:
Vector2f& oppositeVector(const Vector2f &_vector) { x = -_vector.getX(); y = -_vector.getY(); return *this; } Thanks.