O'Reilly logo

Beginning C++ Through Game Programming, Third Edition by Michael Dawson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Advanced Classes and Dynamic Memory: Game Lobby

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:

  • Combine objects

  • Use friend functions

  • Overload operators

  • Dynamically allocate and free memory

  • Avoid memory leaks

  • Produce deep copies of objects

Using Aggregation

Game objects are often composed of other objects. For example, in a racing game, a drag racer could be seen as a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required