Lesson 45 of 45
C++Lesson 45: Modules and Final Project Overview
15 min
Course progress100%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 45 of 45
C++15 min
Keep these ideas in mind as you work through the lesson.
C++20 modules replace the traditional preprocessor include model with a compiled module interface, dramatically reducing build times and eliminating many macro‑related pitfalls.
export module name;) declares what is exported.module name;) provides definitions.import name; instead of #include.math module// math.ixx – interface unit
export module math;
export int add(int a, int b) {
return a + b;
}
export int mul(int a, int b);
// math.cpp – implementation unit
module math;
int mul(int a, int b) {
return a * b;
}
// main.cpp – consumer
import <iostream>;
import math;
int main() {
std::cout << \"3+4 = \" << add(3,4) << '\
';
std::cout << \"3*4 = \" << mul(3,4) << '\
';
return 0;
}
Your capstone combines many concepts learned:
Player, Enemy, Map), inheritance, virtual functions.vector, map) for game state.Project roadmap:
Tip: Start small – get a prototype working before adding advanced features like concurrency or networking.
<Alert type="info">Completing the project earns you the highest XP reward and a badge for "C++ Master".