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

     }


Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends

Comments

Contact Us