What is namespace used for, in C++? -


What is used for name-space in C ++?

  using namespace std; Namespace is used to prevent name conflicts.    

For example:

  namespace foo { Class bar {// define it}; } Nameshot Baz {class bar {// defined it}; }   

You now have two square name bars, which are completely separate and different thanks to namespacing.

"Namespace must be specified in order to use sections within that namespace, using" namespace. " That is, the std :: string string becomes.

Comments