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); } }; int main() { Point p1(1, 2); Point p2(3, 4); Point p3 = p1 + p2; cout << p3.x << ", " << p3.y; return 0; }
4, 6