Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Lesson 45: Modules and Final Project Ove | C++ Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. C++ Course

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.

4 points
  • Modules (`export`, `import`)
  • Compilation speed benefits
  • Project structure recommendations
  • Final project deliverables

Modules and Final Project Overview

C++20 modules replace the traditional preprocessor include model with a compiled module interface, dramatically reducing build times and eliminating many macro‑related pitfalls.


Module basics

  • Interface unit (export module name;) declares what is exported.
  • Implementation unit (module name;) provides definitions.
  • Import with import name; instead of #include.

Example: Simple 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;
}

Final Project: Console Adventure Game

Your capstone combines many concepts learned:

  • Classes (Player, Enemy, Map), inheritance, virtual functions.
  • Smart pointers for resource management.
  • STL containers (vector, map) for game state.
  • Filesystem for saving/loading progress.
  • Optional use of modules to split the codebase.

Project roadmap:

  1. Design the data model (entities, items, map).
  2. Implement core gameplay loop with input handling.
  3. Add persistence using file I/O.
  4. (Optional) Refactor into modules.
  5. Write unit tests using the provided practical tests.

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".

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from C++ CourseBrowse activities
Previous lessonLesson 44: Ranges Library (C++20)Course completeBack to the curriculumBack to C++ Course curriculum