Complex Negation (unary operator-)
easyQuestion 68You are working with 2D rotations using complex numbers.
Create a class Complex2 with two ints: real and imag.
Requirements:
1) Constructor Complex2(int r, int i)
2) Getters getR() const, getI() const
3) Overload UNARY operator- to return a NEW Complex2 with both parts negated
Do NOT write a main function.
Expected output
-3 4 0 7
= 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.