- Header files should contain class definitions,
global variable declarations, and function prototypes
for every class, global variable, and function that you expect to appear in
more than one file.
- You may include member-function definitions in the bodies of class
definitions that appear in header files. Externally defined
member-function definitions must appear in source-code files;
they cannot appear in header files that are included in more
than one file.
- If you want to declare an ordinary function,
then leave behind a function prototype:
return data type function name (data type of parameter 1,
...,
data type of parameter n)
- If you want to declare a global variable,
then instantiate the following pattern:
extern data type variable name;
- You can declare functions and variables as often as you like.
You can define them only once.
- If you want to compile a set of files independently,
then include appropriate header files
and instantiate the following pattern:
CC -c first source specification ...
- If you want to link together a set of independently compiled files
to form a working program,
then instantiate the following pattern on one line:
CC -o executable file specification
first object file specification
...