Yes, so you can see that it also applies when overloading binary operators: the current object (i.e., *this) is the left hand operand when overloading as a member function.
Yes, so you can see that it also applies when overloading binary operators: the current object (i.e., *this) is the left hand operand when overloading as a member function.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
It would be legal as a non-member if the left-hand (the first) parameter was a reference to dummy_class. That is,
void operator+(dummy_class& lhs, dummy_class* test); // Fine
void operator+(dummy_class* lhs, dummy_class* test); // Not fine
Also note that operator + should return a temporary of its left-hand side type. So it should be
dummy_class operator+(dummy_class& lhs, dummy_class* test);
But addition of two pointers is not an operation which is defined?
Great, so I was correct it #18. Thanks for pointing it out.