I have a CCounter class that contains an integer value protected by mutex. I have defined several statements, such as post / pre inc / dec, that return an integer so that I can:
CCounter c(10); int i = c++;
but what should I do with a simple assignment like i = c ? I tried to define the friend = operator, but it gives me
operator=(int&, const CCounter&)' must be a nonstatic member function
mistake. Please advise. Thanks.
c ++ operator-overloading
jackhab
source share