Browse - programming tips - c++ pre post increment operatorDate: 2011apr29 Language: C++ Q. 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: class MyClass { int i; public: void operator++() // PRE-increment { ++i; } void operator++(const int) // POST-increment { i++; } };
Add a commentSign in to add a comment | Advertisements:
|