web analytics

What is namespace?

Namespace: Namespace defines a scope for the identifiers that are used in the program. To use we will do the following

     using namespace namespace_name;

here, at namespace_name we will give the name of the namespace we want to use. Supposing that we are writing the following,

     using namespace std;

here, std is the namespace where ANSI C++ standard class libraries are defined. This will bring all the identifiers defined in std to the current global scope. We can also create namespace in following format,

     namespace namespace_name{
          /*Declaration of variables,
     functions, classes etc should be given here*/

     }



Thank you. Take a moment to share 🙏