views:

81

answers:

3

as i said i get this horrible error i dont really know what to do anymore

 float n= xAxis[i].Normalize();

thats where i get the error and i get it cuz normalize is a void function this is it

void CVector::normalize()
{
 float len=Magnitude();
 this->x /= len;
 this->y /= len;  
}

i need normalize to stay as void tho i tried normal casting like this

float n= (float)xAxis[i].Normalize();

and it doesnt work also with static,dynamic cast,reinterpret,const cast and cant make it work any help would be really apreciated... thank you >.<

+2  A: 

A void function doesn't return anything, so there's nothing to assign to n.

You should return some value from normalize to assign it to n.

float CVector::normalize()
{
 float len=Magnitude();
 this->x /= len;
 this->y /= len;
 return 10.0;
}
WhirlWind
thats what i thought oh well im just modifying it to float ty vm
Makenshi
If you are just updating class members, you may be able to look at those instead of returning anything.
WhirlWind
yeah sadly the thing is im modifying another class :S lol ty i think it works fine like that it was just me being ambitious XD
Makenshi
A: 

Normalize doesn't return a value as it has a void return type. It changes an internal member. So you have to access that member directly or an accessor that returns that member.

Brian R. Bondy
A: 

The Normalize() method doesn't return anything, so you can't assign the return value to a variable. Probably Normalize() just modifies the object it is called on.

sth