Operator Overloading of Decrement — Operator

by anupmaurya
0 comment

Decrement operator can be overloaded in similar way as increment operator.

Output

i = 3 i = 3 i = 2 i = 2 i = 1 i = 2
Code language: C++ (cpp)

Also, unary operators like: !, ~ etc can be overloaded in similar manner.

You may also like