+ 1

how to overload pre and post++?

this came in my college exam , i got full marks as my teacher is dumb she doesnt even know , how to write helli world😂😂 but i want answer.

10th Dec 2016, 6:57 PM
manish rawat
manish rawat - avatar
3 Answers
11th Dec 2016, 9:11 AM
Ettienne Gilbert
Ettienne Gilbert - avatar
+ 1
Basically overloading ++ is ambiguous since the compiler has no way to determine if you want pre- or post-increment. The solution the C++ Standards Committee came up with is to require a dummy parameter for post-increment (which is not used) . This is really just a fudge to allow you to have 2 overloaded functions for the 2 cases. But that is the "official" way it is done.
11th Dec 2016, 9:22 AM
Ettienne Gilbert
Ettienne Gilbert - avatar
0
awesome thanks but i dont get it😞
11th Dec 2016, 9:14 AM
manish rawat
manish rawat - avatar