What is namespace?

Last updated on June 13th, 2020 at 08:34 pm

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*/

     }



Leave a Reply

Your email address will not be published. Required fields are marked *