Im using mingw and everytime i try to type cast a void * to a special class of mine i get some bs about it being a "non-aggregate type" can anyone help?
Im using mingw and everytime i try to type cast a void * to a special class of mine i get some bs about it being a "non-aggregate type" can anyone help?
o i forgot to mention its like this
void *Account;
and then i try to type cast Account to CPlayer so i can use the char *Name within CPlayer's... right now i got some ghetto system of resassigning like
CPlayer *boo = (CPlayer *)Account;
strcpy(boo->Name,"Bob");
i want to be able to use it directly like this
strcpy(Account->Name,"Bob");
plzzz help!
You just can't do it directly like that. You'd have to do:
strcpy(((CPlayer*)Account)->Name,"Bob");
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
right, a void * has no members. you have very little hope of calling functions off of it.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
aha thank you very much i didnt know to include the Account within the () i was doing thiS (CPlayer *)Account->Name; and getting the error:P thanks again!
How do u type cast something like this
CConnection *con;//which has a void * to Account which is a CPlayer which has a bool named Online
like con->Account->Online = true; ?
arr i have two books on C++ neither dable into type casting very well
((CPlayer *) (con->Account))->Online = true;Originally posted by some moron
How do u type cast something like this
CConnection *con;//which has a void * to Account which is a CPlayer which has a bool named Online
like con->Account->Online = true; ?
arr i have two books on C++ neither dable into type casting very well
hello, internet!