+ 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.
3 ответов
+ 1
I wrote an answer with code here: http://www.sololearn.com/app/sololearn/playground/c4BgbEv35NSx/
+ 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.
0
awesome thanks
but i dont get it😞