1. Technology
Send to a Friend via Email

Definition of Namespace

By

Definition: A namespace is a C++ and C# directive that prevents clashes of identifiers.

A developer may use an identifier such as a class name called calculus in an application. The same developer may also add 3rd party libraries to the project. Without namespaces, if a 3rd party library had an identifier called calculus then the compiler or linker would have trouble distinguishing them. By using namespaces- say myapp for the developers library and thirdparty for the thridparty library, the compiler sees the two identifiers as something like myapp.calculus and thirdparty.calculus and there is no ambiguity.

Note

In C++ the syntax for namespaces uses :: not . as in

myapp::calculus

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

©2014 About.com. All rights reserved.