class MyClass { int i; public: void operator++() // PRE-increment { ++i; } void operator++(const int) // POST-increment { i++; } };
Programming Tips - C++: How do I declare the pre and post increment operators?
Date: 2011apr29
Language: C++
Q. C++: How do I declare the pre and post increment operators?
A. The post increment has a parameter of int and pre is has no parameters.
For example: