Every function that a program uses must be defined exactly once in the program, except for inline functions. (Function templates are a little different; see Chapter 7 for details.) An inline function must be defined in every source file that uses the function. This section discusses function definitions and their relationship to their declarations.
In a source file, every function must be declared or defined
before it is used. For functions defined in libraries or other source
files, the convention is to declare the function in a header
(.h or .hpp) file, and the source file where the
function is called must
the header file. Every function that is used in the program must have
Inline functions must be defined in every source file in which
they are used. This is typically accomplished by defining them in a
header file, which you must
#include in each source file that calls the
inline function. Every definition of an inline function must be
A function type includes the language linkage, return type, parameter types, and cv-qualifiers. Note that for each parameter, only its type is significant; its name, storage class, and cv-qualifiers are not part of the function type. Exception specifications are not part of a function's type.
A single source file can have multiple declarations of the same function (that is, functions with the same type), even if those declarations differ ...