extern int bar;
extern int g(int, int);
double f(int, double); // extern can be omitted for function declarations
class foo; // no extern allowed for type declarations
[/codesyntax]
而下边的代码是对上述“申明”的具体“定义”:
[codesyntax lang=”cpp” lines=”normal”]
int bar;
int g(int lhs, int rhs) {return lhs*rhs;}
double f(int i, double d) {return i+d;}
class foo {};