I have a player class that uses my DirectX Graphics class to create surfaces and draw sprites.
I am passing the graphics class as a pointer to the player class methodlike this:
**game.cpp**
m_pPlayer->Init(Graphics* graphics);
Inside the player class my Init method passes the pointer to another pointer method. Is there any benefit to creating another graphics pointer in the player class and copying the pointer argument instead?
So this:
**player.cpp**
m_pSurface->Init(graphics, m_width, m_height);
vs this:
**player.cpp**
m_pGraphics = graphics;
m_pSurface->Init(m_pGraphics, m_width, m_height);
I know that having a m_pGraphics pointer allows me to reuse the pointer again in the same class, such as my drawing method but I call the method in the player class anyway so can't I just keep passing the pointer over and over again?