Namespaces
Different libraries may use the same identifier to in
different contexts that can potentially lead to conflicts
in your program. the Standard C++ Library provides
for namespaces to solve this problem. A namespace
groups identifiers in a named scope. By so specifying
the scope of identifiers within the namespace of the
group to which they belong, the potential for conflict
between identifiers is greatly reduced. The C++
standard library defines all identifiers in a namespace
called std. Here is one example of how you can apply
namespaces when using a function from the C++
standard library.
using std::cin // here we used the using declaration to
specify the namespace for cin.
You can also specify the std namespace with the using
directive,
using namespace std;
All statements that follow this one, can then use
identifiers from the std namespace as if it were
qualifying each one. Such a global directive (like
everything global) should only be used when the
context of application is very clear.
\Ivo D. Dinov, Ph.D., Department of Neurology
and Program in Computing, UCLA School of Medicine/