Problem with unary minus overloading
the assignment is to make a class to handle 3 dimensional vectors and to overload all the operators associated with them. I have it running perfectly except for unary minus. maybe you guys can help:
prototype:
Code:
class Vector
{
public:
Vector operator - (const Vector& v1);
//there are about ten other functions, but they're all working
private:
double x;
double y;
double z;
//variables to hold user inputted coordinates
};
int main()
{
//menu driven with 7 options, all of which work except unary
minus
}
//here's the definition
Vector Vector::operator - (const Vector& v1)
{
Vector temp;
temp.x = -v1.x;
temp.y = -v1.y;
temp.z = -v1.z;
return temp;
}
it's on three files: header, application, and implementation. everything is included fine and it works when I take out the unary minus function. the error message I get says it can't find a function to match my use of unary minus and I can't figure it out