•Namespace is simply a declarative area.
•The purpose of namespace is to localize names of identifiers to avoid name collisions.
•Elements declared in one namespace are separate from elements declared in another.
•Namespace is an important concept for library developer.
•If you include two libraries both having same function prototype, then compiler will be unable to detect which one you are referring to when you invoke it.
namespace name{ //declarations}
•Anything defined within a namespace statement is within the scope of that namespace
•Using:
using namespace name;
(to include only a particular namespace defined in a library)
•using name::member
(to include only a particular member of the namespace defined in a library)
•The purpose of namespace is to localize names of identifiers to avoid name collisions.
•Elements declared in one namespace are separate from elements declared in another.
•Namespace is an important concept for library developer.
•If you include two libraries both having same function prototype, then compiler will be unable to detect which one you are referring to when you invoke it.
Syntax:
•Creating a namespace : namespace name{ //declarations}
•Anything defined within a namespace statement is within the scope of that namespace
•Using:
using namespace name;
(to include only a particular namespace defined in a library)
•using name::member
(to include only a particular member of the namespace defined in a library)
No comments:
Post a Comment