I'm trying to print the names of some instances of Player, which is stored in a List<Player> players. What should I replace "Plop!" with to get this to work?
list<Player>::iterator it;
for(it=players.begin(); it != players.end(); ++it) cout << "Plop!" << " ";
cout << endl;
I have tried
*it.getName();
*it->getName();
I have a feeling that the iterator should be handled differently than if it would be a normal pointer. Or perhaps the iterator *it does not contain the Player object at all?
operator<<for Player class. Either as an overload or a friend function.