2009-12-26 02:49:54 UTC
I'm Now getting a C2677 Error, and while I understand what can cause it, I'm not sure how to solve it in my case, I'm hoping someone could explain Operators to me in a bit more.
The Relevant Code i have is:
float operator*(const float& value, const Vector& v) // This is the Operator I'm trying to make
{
return v.getX() * value + v.getY() * value;
}
Here is the only place the code is used:
Vector PhysicsObject::getAcceleration(void)
{
acceleration.scale(0); //sets Acceleration to 0
for(int count = 0; count < forcesList; count++)
{
acceleration = acceleration + (inverseMass * forces[count]); //this is the line that Generates the Error
}
return acceleration;
}
The Error Given is:
error C2677: binary '*' : no global operator found which takes type 'Vector' (or there is no acceptable conversion)
If any more of my Code is needed please ask I'll add it ASAP. Any help will be greatly appreciated, I've spent a while racking my brains now :(