Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
305 B
1
Indexable
Never
#include <iostream>
using namespace std;
class Int {
public:
	int v;
	Int(int a) { v = a; }
	Int &operator[](int x) {
		v += x;
		return *this;
	}

};

ostream &operator <<(ostream &o, Int &a) {
	return o << a.v;
}

int main() {
	Int i = 2;
	cout << i.v << i[2] << i.v;
	return 0;
}
Leave a Comment