#include namespace Tester { // Will not compile. 'x' has not been declared yet // Names must be declared before their use in a namespace see [3.4.1] // void hw() // { // std::cout << "Hello World val= " << x << std::endl; // } int x = 33; void hw() { std::cout << "Hello World val= " << x << std::endl; } } int main(int argc, char** argv) { Tester::hw(); return 0; }