12. Namespaces & Modularization

In this chapter we primarily discuss two quite simple and somewhat related concepts. The first is modularization: breaking an application down into subparts. This is accomplished by dividing one’s code into several files, which can then be reassembled when the application is compiled.

The second subject is namespaces, which is kind of new to C++ (and not found in C at all). The more you program and the more complex your applications become, the more necessary namespaces are. You’ve actually been dealing with namespaces without even knowing it throughout the entire book, so it’s about time you formally learn about that subject.

Included in this mix of subjects is another explanation of variable scope: where variables ...

Get C++ Programming: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.