Note that variables cannot be defined in header files !!! Generally, only variables are declared in the header file, because the header file
To be included by other files (I .e. # include), if you put the definition in the header file, you cannot avoid defining variables multiple times,
C ++ does not allow multiple definitions of variables. A program only defines the specified variables once and can be declared countless times.
However, there are three exceptions. The definition of the third entity can also be placed in the header file.
1. Definitions of known const variables at compilation can be put into the header file, for example, const int num (10 );
2. class definitions can be placed in header files.
3. inline functions
4. The new constexpre int num (10) in C ++ 11 should be okay.
These three entities can be defined in multiple source files, as long as the definitions in each source file are the same.
Variables cannot be defined in header files.