I'm developing the Nim game right now, and I'll get straight-to-the-point here. I have a function with "player1" and "player2" defined, and I want to use both of them in another function. Here's the function where they're both defined:
void ScoreKeeperInfo::welcome() {
    cout << "Welcome to the Game of Nim.\n\nWhat is your name? ";
    cin >> playerName;
    Player player1 = new PlayerInfo(playerName);
    Player player2 = new AutomatedPlayerInfo("HAL 9000", new IntermediateStrategyInfo);
    cout << "Number of wins for " << player1->getName() << ": " << numberOfWinsPlayer << endl;
    cout << "Number of wins for HAL 9000: " << numberOfWinsCPU << endl;
}
I'm attempting to use them in this function here, where it says "Game game = new GameInfo(player1, player2, state)":
void ScoreKeeperInfo::playRepeatedly() {
    int pile1 = Utils::generateRandomInt(6, 12);
    int pile2 = Utils::generateRandomInt(6, 12);
    int pile3 = Utils::generateRandomInt(6, 12);
    string userInput;
    GameState state = new GameStateInfo(pile1, pile2, pile3);
    string stateDisplay = state->toString();
    if (playerFirst == true) {
        Game game = new GameInfo(player1, player2, state);
        Player winner = game->play();
        cout << winner->getName() << " wins.\n";
I have this for a header file for this class:
class ScoreKeeperInfo {
public:
    void start();
private:
    Player player1, player2;
    int numberOfWinsPlayer = 0;
    int numberOfWinsCPU = 0;
    bool playerFirst;
    string playerName;
    void welcome();
    void flipCoin();
    void playRepeatedly();
    void restart();
};
#endif  /* SCOREKEEPER_H */
Then I used typedef for declaring the Player pointers:
typedef class MoveInfo* Move;
typedef class GameStateInfo* GameState;
typedef class PlayerInfo* Player;
typedef class AutomatedPlayerInfo* AutomatedPlayer;
typedef class StrategyInfo* Strategy;
typedef class IntermediateStrategyInfo* IntermediateStrategy;
typedef class GameInfo* Game;
typedef class ScoreKeeperInfo* ScoreKeeper;
Would I be able to get a pointer (bad pun) with where to go when I'm trying to use the player1 and player2 pointers out-of-scope? "player1->getName()" in the first function outputs exactly what I want, and I need it in the second block of code.
Thanks!
