At the beginning of my app I have a global variable gameData
which is declared and instantiated as:
GameData gameData = GameData();
Later I want to clear the gameData
variable and re-instantiate/reset the variable with a clean instance of GameData
. I do this by calling a function:
void ResetGameData() {
gameData = new GameData();
}
But that's not clearing the gameData
variable. All the old values are remaining. Is there a better way of doing this?