C++ gives a game programmer a high degree of control over the computer. One of the most fundamental abilities is direct control over memory. In this chapter, you’ll learn about dynamic memory—memory that you manage yourself. But with great power comes great responsibility, so you’ll also see the pitfalls of dynamic memory and how to avoid them. You’ll learn a few more things about classes, too. Specifically, you’ll learn to:
Use friend functions
Dynamically allocate and free memory
Avoid memory leaks
Produce deep copies of objects
Game objects are often composed of other objects. For example, in a racing game, a drag racer could be seen as a ...