© Ivor Horton and Peter Van Weert 2020
I. Horton, P. Van WeertBeginning C++20https://doi.org/10.1007/978-1-4842-5884-2_11

11. Modules and Namespaces

Ivor Horton1  and Peter Van Weert2
(1)
Stratford-upon-Avon, Warwickshire, UK
(2)
Kessel-Lo, Belgium
 

While cramming all your code into a single source file is always possible (even for huge programs), a larger code base is far easier to manage if you organize related source code (functions, constants, types, and so on) into logical, composable units, each in their own files. Not least because you and others can then construct different applications out of these same building blocks. As of C++20, the composition unit of choice is a module.

The more your code base grows and/or the more third-party libraries ...

Get Beginning C++20: From Novice to Professional 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.