PDA

View Full Version : [C++] Double Pointers?



slooksterpsv
January 21st, 2014, 07:35 AM
Hi all I have a question:

My game creates a new game object and passes the SDL_Renderer everywhere image handling, processing to the screen, etc. needs to be done. While this is fine I was wondering if it's possible to do something like the following:



Game* gameInst = new Game(640,480);
...

Game** gameObject;

...

void Editor::OnInit(Game* game)
{
gameObject = &game;
}

...

Editor* editor = new Editor();

editor->OnInit(&gameInst);
...


To pass around the data. Would this be feasible or not?

spjackson
January 21st, 2014, 09:39 AM
It is possible with

void Editor::OnInit(Game** game)
{
gameObject = game;
}