forked from natto1784/ooplab
22
lab7/19.cpp
Normal file
22
lab7/19.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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();
|
||||
}
|
Reference in New Issue
Block a user