Skip to main content

Header Contract Model

Challenge on lesson: Checkpoint: Multi-File Thinking

Model a multi-file project in one file: implement int add(int, int) (the "math_utils.cpp" definition), a bool declared_only(int) that must exist so the "main.cpp" side links (declare-and-define pattern), and int call_add(int, int) which calls add through its declaration-style usage. Then fix the classic bug: kMaxRetries must be a shared constant usable from "several files" — define it correctly for a header.

Difficulty: beginner

Back to lesson: Checkpoint: Multi-File Thinking