Chapter     7

Organizing Projects Using Files and Namespaces

In Chapter 6 we ended with a file that contains functions and structures that were related to completely different high-level concepts. Some were there to control the game loop, others to obtain user input and write output, and a structure to represent the player model. Eventually this code would become difficult to manage and work with if we were to continue down this path of adding everything to a single file.

We have already seen that we can split new functions into declarations and definitions as well as being able to use the #include directive to be able to use functionality that is contained within separate files. All of the examples we have used so far have used the using namespace ...

Get Learn C++ for Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.