Hi
Please take a look at the following example.
Code:
#include <iostream>
class test{
public:
int integer;
void operator-();
};
void test::operator-() {
(*this).integer++;
}
int main() {
test temp;
temp.integer = 1;
+temp;
cout << temp.integer << endl;
getch();
return 0;
}
When talking about binary operators (overloaded by member functions), the left argument is passed by reference to the *this-pointer. But in the case with unary operators, it is the right argument that is passed to the *this-pointer?