Skip to content

Instantly share code, notes, and snippets.

@greg-hellings
Created March 24, 2020 17:19
Show Gist options
  • Save greg-hellings/0186f98c457476e1912f2825136d7770 to your computer and use it in GitHub Desktop.
Save greg-hellings/0186f98c457476e1912f2825136d7770 to your computer and use it in GitHub Desktop.
#include <iostream>
class Poop {
public:
Poop(int i, int j) :
x(i),
y(j) {}
int x = 0;
int y = 0;
};
Poop operator + (int q, Poop f) {
f.x += q;
return f;
}
int main() {
Poop p(1, 2);
p = 7 + p;
std::cout << p.x << " " << p.y << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment