It can't be a member function, because the expression 2*p1 would mean
p = 2 * p1;
would mean
p = 2.operator*(p1); // 2 is not of class type
So we would need to make operator* be a non-member function. (It will have 2 parameters.)
It can't be a member function, because the expression 2*p1 would mean
p = 2 * p1;
would mean
p = 2.operator*(p1); // 2 is not of class type
So we would need to make operator* be a non-member function. (It will have 2 parameters.)