June 2025
Intermediate to advanced
1093 pages
33h 24m
English
That's easier said than done, because often the boundaries of functionalities are fluid.
When you break down your program into *.cpp and *.hpp files, the consequence is that the various *.cpp and *.hpp files include other *.hpp files via #include.
It gets bad when every file needs all the other files. Try to keep the number of required #include directives small.
Cyclic dependencies are really tricky—where A.hpp includes B.hpp, but in B.hpp you then realize that you actually need A.hpp first. You solve this by separating one (or both) headers so that only the *.cpp file needs the other header.
I therefore recommend following these rules:
Separate your program into layers. One layer may only use things from ...
Read now
Unlock full access