Files
ooplab/lab7/19.cpp
Amneesh Singh 7ba9554ed5 labs 7: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-26 16:53:39 +05:30

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();
}