inline. "There is no function here."
int c = a + b;
The above is same as this:
1 2 3
|
inline int foo( int x, int y ) { return x+y; }
..
int c = foo( a, b );
|
The compiler could not replace
foo( a, b ) with the body of foo, if it could not see the body of foo.
Compiling a program has two stages. First, compiler generates an object file for each compilation unit. Second, a linker forms the executable binary from the object files and necessary libraries.
Lets look at a simple program:
1 2 3 4
|
#include <iostream>
void main() {
std::cout << "Hello Dolly!\n";
}
|
It does refer to a global object std::cout and calls function operator<<. Both are implemented in some other compilation unit (within a library). The header file "iostream" declares those two. Those declarations are needed by the compiler to ensure that the linking will have in the main's object file calls that match symbols within library.
A header just says: "By the way, there exists function
int foo( int, int)
somewhere". It is a
declaration. It does not
use anything. A class does not "exist" in header; it is just a concept.