In many programs
using VC++ compilers
i have seen this thing
There are a lot of libraries in c++. In some there may be functions with the same name. To distinguish them namespaces are used.
for example, you create a class library:
Code:
namespace myn
{
class cin
{
puclic:
int c(void);
}
}
Now you can call your function and be sure that compiler understand that it is your class cin and not a standard input stream:
Code:
#include <iostream>
...
int kk = myn::cin.c(); // your function
char c = std:: cin.getc(); // standard cin has 'std' namespace
...
You can use namespaces as written in prev. example, or you add line
Code:
using namespace std;
and write everywhere without 'std::'. Like here:
Code:
#include <iostream>
using namespace std;
...
char c = cin.getc();
cin >> c;
Comment