CJCoding With Joseph
15per day

Complex Negation (unary operator-)

You 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
Topics:
ClassesOperator Overloading
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.