Thanks for any help!Code:Class A { public: A& operator=(const A& rhs); private: const int i; int j; }; A& A::operator=(const A& rhs) { j = rhs.j; // this is OK i = rhs.i; // compiler error! how can I make this work? } // Not shown: operator= will check for assignment to self // and return *this, like all good assignment operators.




Reply With Quote