UnNamed or Anonymous Namespaces in c++





This video tutorial explains about the un-named namespaces or the anonymous namespaces in c++ programming.
You are gonna learn what are anonymous or unnamed namespaces, how to define a unnamed namespace, how to access the members of a unnamed namespace in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;

namespace {
int x;
void display();
}

namespace{
void display(){
cout << "x is "<<x<<endl;
}
}

int main()
{
    x = 25;
    display();
    return 0;
}

 
Back To Top