forked from natto1784/ooplab
23 lines
267 B
C++
23 lines
267 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
class Foo {
|
|
int x;
|
|
|
|
public:
|
|
Foo(int _x) { x = _x; };
|
|
Foo &operator++();
|
|
int get() { return x; }
|
|
};
|
|
|
|
Foo &Foo::operator++() {
|
|
x++;
|
|
return *this;
|
|
}
|
|
|
|
int main() {
|
|
Foo bar = Foo(-3);
|
|
++bar;
|
|
cout << bar.get();
|
|
}
|