Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
#include
using namespace std; class Point { public: int x, y; Point(int x, int y) { this->x = x; this->y = y; } Point operator+(Point other) { return Point(x + other.x, y + other.y); } }; ostream& operator<<(ostream& out, Point p) { out << "(" << p.x << ", " << p.y << ")"; return out; } int main() { Point p1(1, 2); Point p2(3, 4); cout << p1 + p2; return 0; }
(4, 6)