A namespace
- A section of code
- Delimited and referred to using a specific name
- Give a common name to that portion of code so that, when referring to it, only entities that are part of that section would referred to
A namespace is created to
- Set apart a portion of code with the goal to reduce, otherwise eliminate, confusion
How to use namespace
- Type the using namespace expression followed by the name of the namespace and a semi-colon (A-1)
Example of (A-1)
using namespace thebasic;
One of the namespaces used in C++
- Is called std (A-2)
- After typing this, any part of the namespace becomes available to you
Example of (A-2)
using namespace std;
The iostream library
- Is part of the std namespace
- When you use it, you don’t need to include the extended of the iostream file
You can start your program with (A-3):
Example of (A-3)
#include <iostream> using namespace std;

Discussion
No comments for “Introduction to Namespaces”