May 2012
Intermediate to advanced
679 pages
16h 56m
English
In large programs, we have large number of identifier. It is possible that there may be duplicate names for classes, functions, objects, types, etc. As we know, duplicate names are not allowed. Hence, the concept of namespace comes in. It is the synonymous of scope in C++. A typical declaration looks as
namespace [identifier] { namespace-body }
A namespace is a keyword. Optional identifier follows it. This identifier is the name of the namespace being declared. Namespace-body is a declarative region.
It goes without saying that declarations which are related to each other by some criterion are supposed to be placed in a namespace. Variables within the namespace are required to be unique. However, our program ...
Read now
Unlock full access