< Previous | Contents | Next >
Introducing the Tic-Tac-Toe 2.0 Game
The project for this chapter is a modified version of the project from Chapter 6, the Tic-Tac-Toe game. From the player’s perspective, the Tic-Tac-Toe 2.0 game looks exactly the same as the original because the changes are under the hood— I’ve replaced all of the references with pointers. This means that objects such as the Tic-Tac-Toe board are passed as constant pointers instead of as references. This has other implications, including the fact that the address of a Tic-Tac-Toe board must be passed instead of the board itself.
You can download the code for the new version of the program from the Course Technology website (www.courseptr.com/downloads). The program is in the Chapter 7 folder; the filename is tic-tac-toe2.cpp. I won’t go over the code because most of it remains the same. But even though the number of changes isn’t great, the changes are significant. This is a good program to study because, although you should use references whenever you can, you should be equally comfortable with pointers.