Namespace

related topics
{math, number, function}
{language, word, form}
{country, population, people}

In general, a namespace is an abstract container providing context for the items (names, or technical terms, or words) it holds and allows disambiguation of homonym items residing in different namespaces.

As a rule, names in a namespace cannot have more than one meaning, that is, its components cannot share the same name. A namespace is also called a context, as the valid meaning of a name can change depending on what namespace applies. Names in it can represent objects as well as concepts, whether it is a natural or ethnic language, a constructed language, the technical terminology of a profession, a dialect, a sociolect, or an artificial language (e.g., a programming language).

For many programming languages, a namespace is a context for identifiers. In an operating system, an example of namespace is a directory. Each name in a directory uniquely identifies one file or subdirectory, but (through hard links) one file may have multiple names. In the Java programming language, items that appear in namespaces have a short (local) name and unique long "qualified" names for use outside the name space. Also, some compilers (for languages such as C++) combine namespaces and names in a process called name mangling.

Below is an example of a namespace in C++:

namespace Box1{
   int boxSide = 4;
}
 
namespace Box2{
   int boxSide = 12; 
}
 
int main () {
  cout << Box1::boxSide << endl;  //output 4
  cout << Box2::boxSide << endl;  //output 12
  return 0;
}

[edit] See also


Full article ▸

related documents
Centralizer and normalizer
Fibonacci
Canonical Encoding Rules
Code word
Simple module
Liouville function
Euler's sum of powers conjecture
Tomaž Pisanski
List of basic mathematics topics
Face (geometry)
Elementary event
Euler-Jacobi pseudoprime
Pedal triangle
Star height problem
Landau's function
RIPEMD
Cfront
Location parameter
Unknot
Cypherpunk anonymous remailer
Persistence
FIPS county code
XBasic
Central moment
Mnemonic dominic system
Sequential access
Mrs. Miniver's problem
Sample space
Randomization
XPointer