Untitled
unknown
plain_text
a year ago
305 B
4
Indexable
#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; }
Editor is loading...
Leave a Comment