Check this:
http://msdn.microsoft.com/library/de...m/progs_20.asp
A translation unit contains a sequence of one or more declarations. The Standard uses the term translation unit rather
than source file because a single translation unit can be assembled from more than a single source file: A source file
and the header files that are #included in it are a single translation unit.
External Linkage
A name that can be referred to from other translation units or from other scopes of the translation unit in which it was
defined has external linkage. Following are some examples:
Code:
void g(int n) {} //g has external linkage
int glob; //glob has external linkage
extern const int E_MAX=1024; //E_MAX has external linkage
namespace N
{
int num; //N::num has external linkage
void func();//N::func has external linkage
}
class C {}; //the name C has external linkage
Internal Linkage
A name that can be referred to by names from other scopes in the translation unit in which it was declared, but not
from other translation units, has internal linkage. Following are some examples:
Code:
static void func() {} //func has internal linkage
union //members of a non-local anonymous union have internal linkage
{
int n;
void *p;
};
const int MAX=1024; //non-extern const variables have internal linkage
typedef int I; //typedefs have internal linkage
Names With No Linkage
A name that can only be referred to from the scope in which it is declared has no linkage. For example
Code:
void f()
{
int a; //a has no linkage
class B {/**/}; //a local class has no linkage
}