Having a problem with a loss of member data when passing the object through to a seperate function. Relevant code fragments are:
If I use "cout << C4game->getPlayers()" at this stage, it will show the number of players which has been entered (one or two). Next...
Engine* theEngine = new Engine;
if (option == 1)
Connect4* C4game = new Connect4;
theEngine->setStarter(C4game->getPlayers(), C4game->getRows(), C4game->getColumns());
If I were to write "RelevantGame->getPlayers()" at the start of this function, it will automatically show as zero - it's as though the member data was being wiped whilst the parameter is being passed. Between calling the RunSinglePlayer() function and actually arriving there, the data is disappearing.
void Engine::RunSinglePlayer (Game* RelevantGame)
unsigned short CounterLocation;
PlayerGo = 1;
Connect4 is a derived class from Game, and they both hold the same member data, so there should be no issue from that perspective (unless I've missed something?).
Anyone have any ideas why this is happening and how it can be resolved?
Many thanks! :-)