First of all, in your implementation above, you need to return the type of count
instead of void
.
For example, suppose you've declared int count
.
Then you need to return int
in the 'postfix' version, and int&
or const int&
in the 'prefix' version.
Try b = a++
and b = ++a
, and you will see (of course, you'll need each function to return a value).
The difference between these two versions is only in the return value. The 'prefix++' returns the value of count
before the operation, and the 'postfix++' returns the value of count
after the operation.
In addition, due to its nature, the 'postfix++' can only return a copy of the variable being incremented (e.g., int
), whereas the 'prefix++' can also return a reference of that variable (e.g., int&
).
Since you are not returning anything in your implementation, you cannot make any use of the difference between these two versions.