Namespace
is an additional feature of C++, which is defining the scope of a variable, function or object and avoiding the name collision. Here, the string
object is defined in the std
namespace.
std
is the standard namespace. cout
, cin
, string
and a lot of other things are defined in it.
The header <string>
declares the various entities related to the strings library, whereas namespaces are used to group related functionality and allow use of the same names in different namespaces.