Ok, I have been looking at some other posts here about this but I have a question.I want to be able to do "INT aa=5; INT bb=7; INT cc = aa+bb" but I am not sure how. Can someone help me?Code:class INT { public: INT() {} INT(int c) {a = c;} ~INT() {} int getVal() {return a;} void operator = (int x) {a = x;} void operator = (INT x) {a = x.getVal();} INT& operator + (int x) {a += x; return *this;} INT& operator + (INT& x) {a += x.getVal(); return *this;} private: int a; };




Reply With Quote