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?
Printable View
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");
right, a void * has no members. you have very little hope of calling functions off of it.
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;Quote:
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 :(