Modifying vector.cpp

We will need to add two new overloaded operators to our Vector2D class. We will need to overrideĀ operator- and operator+. This code is pretty straightforward. It will use the already overloaded operator-= and operator+= to allow us to add and subtract vectors from each other. Here is the new code for those overloaded operators:

Vector2D Vector2D::operator-(const Vector2D &vec) {
Vector2D return_vec = *this;
return_vec -= vec;
return return_vec;
}

Vector2D Vector2D::operator+(const Vector2D &vec) {
Vector2D return_vec = *this;
return_vec += vec;
return return_vec;
}