Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- class ComplexNr
- {
- public:
- int x, y;
- ComplexNr (int x, int y)
- : x(x), y(y) {};
- ComplexNr operator +(const ComplexNr& other) const
- {
- return ComplexNr(this -> x + other.x, this -> y + other.y);
- }
- };
- int main ()
- {
- ComplexNr p1(1, 1), p2(5, 3);
- ComplexNr p = p1 + p2;
- cerr << p.x << ' ' << p.y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement