Vector2D Add-Assign (operator+=)
easyQuestion 62You are moving a character on a 2D grid.
Create a class Vector2D with two ints: x and y.
Requirements:
1) Constructor Vector2D(int x, int y)
2) Getters getX() const, getY() const
3) Overload operator+= to add another Vector2D into this one and return *this
Do NOT write a main function.
Expected output
3 7 -1 0
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
ClassesOperator Overloading
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.