Example: one.h contains a definition of a data type
that is used in two.h.
When one.cpp (or two.cpp) is compiled,
one.h is included twice.
If the header file only contains function prototypes, it can
safely be included more than once. But type or class definitions
cannot appear more than once.
Solution: use #ifndef and #define preprocessor
directives.
The #define directive defines a value for the
preprocessor.
The #ifndef directive causes the preprocessor to
allow the compiler to compile a section of code only if a
value has not been defined. (There is also a #ifdef
directive.)
Example:
The first time the preprocessor goes through a header file,
a value will be defined. On subsequent passes through the file,
the contents of the file will be ignored.
I expect you to use this technique on all your header files.
Function overloading is when the same name is used for
more than one function. Function overloading is also called
function polymorphism. (Do not confuse function
polymorphism with object polymorphism, which we will see later.)