So... I found out about void pointers today...
Posted: Mon Oct 11, 2010 8:13 pm
My question is, how can you use (if you even can) void pointers in a game engine to abstract the custom data type being passed into a function?
I saw a function like this:
Is there a way that you can do this, without creating functions like:
Thanks in advance, and sorry if I didn't explain myself very well.
I saw a function like this:
Code: Select all
void printIntX(void* argX)
{
int a;
a = *(int *) argX;
cout << a;
}
Code: Select all
void useInputComponent(void* argInput)
{
InputComponent a;
a = *(InputComponent *) argInput;
//blah
}
void useRenderComponent(void* argRender)
{
RenderComponent a;
a = *(RenderComponent *) argRender;
//blah blah
}