Namespaces organize variable, function and class names.
#include <iostream>
using namespace std;
namespace ns1
{
int i = 1;
}
int main()
{
cout << " I " << ns1::i << endl;
return 1;
}
We can write 'cout' instead of 'std::cout' because of the 'using' statement.
For reasons of backward compatibility the following line
#include <iostream.h>
is replaced by these:
#include <iostream> using namespace std;