0

Possible Duplicate:
How to differentiate (when overloading) between prefix and postfix forms of operator++? (C++)

Suppose I need to overload an operator function which performs 2 functions.

For example, the first function handles prefix increment and the second function handles postfix. Is there any different syntax for this?

Community
  • 1
  • 1
keerthi
  • 77
  • 1
  • 1
  • 4

1 Answers1

2

This has already been answered: How to differentiate (when overloading) between prefix and postfix forms of operator++? (C++)

The gist of the answer is that prefix takes no parameter, postfix takes an unused int parameter.

A &operator++()    { ... } //prefix
A  operator++(int) { ... } //postfix

Cheers,
Aaron

Community
  • 1
  • 1
NotKyon
  • 383
  • 2
  • 7