if (option == 1)
{
cout << "The current player list is:" << endl;
for (int i = 0; i < AllPlayers.size(); i++)
{
cout << (*(AllPlayers[i])).toString() << endl;
}
}
if (option == 2)
{
cout << "What is the new player's name?" << endl;
cin >> ws;
getline (cin, playerName);
Player newPlayer(playerName);
pointer = &newPlayer;
AllPlayers.push_back(pointer);
cout << "New player as been added." << endl;
}
Option 2 adds the player pointer and Option 1 outputs it as followed:
Name:
Wins: 0
Loses: 0
Draws: 0
and the name doesn't output. I don't know what is wrong because when I output it normally without using the pointer it does output it correctly. I just need to know how to output it correctly with each aspect of the object.