|
The simple answer is that a namespace is a context in which symbols (names of variables, functions, classes, etc) reside. It is similar to how you might refer to your house as 'home', and I refer to mine as 'home'. Yet when you say 'home', I don't think you're talking about my house, and vice versa. In C++ syntax, we would refer to those symbols as BrinyCode::home and lectricpharaoh::home. The full name allows us to avoid the ambiguity that would otherwise occur. C++ namespaces are a mechanism for resolving such ambiguities in code. Other languages have their own mechanism, such as packages in Java, that perform pretty much the same job. Some languages, like C, don't have any such mechanism, which means you're more likely to run into naming conflicts.
For a more comprehensive discussion, see the link that DaWei posted.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
|