< Previous | Contents | Next >

Introducing the Game Lobby Program

The Game Lobby program simulates a game lobbya waiting area for players, usually in an online game. The program doesnt actually involve an online component. It creates a single line in which players can wait. The user of the program runs the simulation and has four choices. He can add a person to the lobby, remove a person from the lobby (the first person in line is the first to leave), clear out the lobby, or quit the simulation. Figure 9.11 shows the program in action.

316 Chapter 9 n Advanced Classes and Dynamic Memory: Game Lobby


image

Figure 9.11

The lobby holds players who are removed in the order in which they were added.


 

The Player ClassThe Lobby ClassThe Lobby::AddPlayer() Member FunctionThe Lobby::RemovePlayer() Member FunctionThe Lobby::Clear() Member FunctionThe operator<<() Member FunctionThe main() Function