C++ Formatting, File Organization, and Styles
Very extensive guide: Google's C++ Style Guide
C++ File Inclusion and Sharing
Header Guard Pattern
In order to prevent duplicate inclusions, it is recommended to adopt the "header guard pattern" (also called "define guard"). It looks something like this:
my_class.h
:
#ifndef MY_CLASS
#define MY_CLASS
// ...
#endif // MY_CLASS
The comment at the end is not part of the macro, nor necessary, but is helpful as a reminder of "here is the end of our define block for {x}!"