Search⌘ K
AI Features

Module Linkage

Explore the concept of module linkage introduced in C++20 modules, differentiating it from internal and external linkage. Understand how module linkage restricts name visibility to inside the module, enhancing encapsulation and template management. This lesson helps learners grasp how C++20 modules improve code structure and compilation efficiency.

We'll cover the following...

Before C++20

Until C++20, C++ supported two kinds of linkages: internal linkages and external linkages.

  • Internal linkage: Names with internal linkage are not accessible outside the translation unit. The internal linkage includes mainly namespace-scope names that are declared static and members of anonymous namespaces.

  • External linkage: Names with external linkage are accessible ...