#include <iostream>
using namespace std;
class Foo;
class Bar;
class Hoge;
class Foo
{
int v;
public:
Foo(int n) { v = n; }
int getV() const { return v; }
void setV(int n) { v = n; }
};
class Bar
{
int v;
public:
Bar(int n) { v = n; }
int getV() const { return v; }
};
Foo operator + (const Foo& foo, const Bar& bar) {
Foo sum(foo.getV() + bar.getV());
return sum;
}
Foo& operator ++ (Foo& foo, int) {
foo.setV(foo.getV() + 1);
return foo;
}
int main() {
Foo foo(123);
Bar bar(900);
foo++;
Foo sum = foo + bar;
cout << sum.getV() << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgRm9vOwpjbGFzcyBCYXI7CmNsYXNzIEhvZ2U7CgpjbGFzcyBGb28KewoJaW50IHY7CnB1YmxpYzoKCUZvbyhpbnQgbikgeyB2ID0gbjsgfQoJaW50IGdldFYoKSBjb25zdCB7IHJldHVybiB2OyB9Cgl2b2lkIHNldFYoaW50IG4pIHsgdiA9IG47IH0KfTsKCmNsYXNzIEJhcgp7CglpbnQgdjsKcHVibGljOgoJQmFyKGludCBuKSB7IHYgPSBuOyB9CglpbnQgZ2V0VigpIGNvbnN0IHsgcmV0dXJuIHY7IH0KfTsKCkZvbyBvcGVyYXRvciArIChjb25zdCBGb28mIGZvbywgY29uc3QgQmFyJiBiYXIpIHsKCUZvbyBzdW0oZm9vLmdldFYoKSArIGJhci5nZXRWKCkpOwoJcmV0dXJuIHN1bTsKfQoKRm9vJiBvcGVyYXRvciArKyAoRm9vJiBmb28sIGludCkgewoJZm9vLnNldFYoZm9vLmdldFYoKSArIDEpOwoJcmV0dXJuIGZvbzsKfQoKaW50IG1haW4oKSB7CgkKCUZvbyBmb28oMTIzKTsKCUJhciBiYXIoOTAwKTsKCQoJZm9vKys7CgkKCUZvbyBzdW0gPSBmb28gKyBiYXI7CgkKCWNvdXQgPDwgc3VtLmdldFYoKSA8PCBlbmRsOwoJCglyZXR1cm4gMDsKfQ==