#ifndef TH //This is not C++ code, just a model to copy and paste. #define TH #include //for ostream and istream #include //for size_t using namespace std; class T { public: T& operator=(const T& another); T& operator+=(int i); T& operator-=(int i); operator int() const; friend bool operator==(const T& t1, const T& t2); friend bool operator< (const T& t1, const T& t2); friend bool operator<=(const T& t1, const T& t2); friend int operator- (const T& t1, const T& t2); int& operator[](size_t i); const int& operator[](size_t i) const; friend ostream& operator<<(ostream& ost, const T& t); friend istream& operator>>(istream& ist, T& t); }; inline bool operator!=(const T& t1, const T& t2) {return !(t1 == t2);} inline bool operator> (const T& t1, const T& t2) {return t2 < t1;} inline bool operator>=(const T& t1, const T& t2) {return t2 <= t1;} inline const T operator-(T t, int i) {return t -= i;} inline const T operator+(T t, int i) {return t += i;} inline const T operator+(int i, T t) {return t += i;} inline T& operator++(T& t) {return t += 1;} inline T& operator--(T& t) {return t -= 1;} inline const T operator++(T& t, int) {const T old = t; ++t; return old;} inline const T operator--(T& t, int) {const T old = t; --t; return old;} #endif