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?
This is a discussion on Type casting void * withing classes? within the C++ Programming forums, part of the General Programming Boards category; Im using mingw and everytime i try to type cast a void * to a special class of mine i ...
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:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 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!