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:
syntax may little off, general idea type-cast it.code:void *myvoidptr; int *myintptr; int myint; myinptr = &myint; myvoidptr = (void *) myintptr;
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk C++ changing void pointer to something else
Ubuntu
Comments
Post a Comment