Skip to main content

Thread: C++ changing void pointer to something else


hey all,

have situation user input determine kind of object created in program. object wrapped class. user's input needs invoke object creation @ execution. issue higher level classes need generic way call object:

car object -> (enginea object, engineb object, enginec object...etc)

enginea,b,c have same function calls (that car object sees anyway). need persistent pointer points either a, b, or c (which decided @ runtime). thought create void pointer , change type of pointer is, think understanding on little off. need create pointer , have point different object depending on runtime. possible?

i think i've seen stuff before:

code:
void *myvoidptr;  int *myintptr;  int myint;    myinptr = &myint;    myvoidptr = (void *) myintptr;
syntax may little off, general idea type-cast it.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk C++ changing void pointer to something else


Ubuntu

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO