There are two possible answers to this question, because of the fact you don't know the class's implementation (as you say).
Scenario one: The class is reasonable
In this scenario, the semantics of ++
are similar to those of built-in types and standard library iterators: ++x
is preincrement, x++
is postincrement.
In such case, ++x
returns the value of x
after the increment. It's actually expected of ++x
to return x
by reference, making ++ ++ x
legal. A typical implementation would be:
A& A::operator++()
{
increment_somehow();
return *this;
}
As you see, no copying (construction) is necessary.
x++
, on the other hand, returns the value before the increment. Which means it must store the value somewhere to be able to return it. A typical implementation would be:
A A::operator++(int)
{
A old(*this); // copy construction
++(*this); // re-use preincrement to keep semantics consistent
return old; // move construction of return value (possibly elided)
}
As my comments above show, there are two constructor calls involved (even though one of them can be elided).
Scenario two: The class is arbitrary
If the prefix and postfix ++
are not indended to match standard semantics, then naturally all bets are off, as the functions can do literally anything. Without knowing more about them, they cannot be compared.