+ 1

Help, overloading the c++ increment operator

How to overload the increment operator in this code!? https://code.sololearn.com/cfm14Hxa1HDt/?ref=app

4th Sep 2022, 8:40 PM
VirusZ
VirusZ - avatar
1 Odpowiedź
+ 3
- You have overloaded pre-increment operator (++x) and calling post increment operator. - "c1" is a pointer pointing to the object, so calling (c1++) would increment the pointer instead of incrementing the object. ( Try ++(*c1) instead ) Here is the fix👇 https://code.sololearn.com/cWRfy5L5Ohih/?ref=app
5th Sep 2022, 12:36 AM
Arsenic
Arsenic - avatar