This syntax is:
tclass operator++()
for the ++ prefix (which is actually usually written as tclass &operator++() ). To distinguish the postfix increment, you add an unused int argument:
tclass operator++(int)
Also note that prefix incrementing returns tclass & better , because the result can be used after: (++rr).x .
Again, note that the postfix increment is as follows:
tclass operator++(int) { tclass temp = *this; ++*this; // calls prefix operator ++ // or alternatively ::operator++(); it ++*this weirds you out!! return temp; }
source share