using Directive
- A C++ program can be divided into different namespaces. A namespace is a part of the program in which certain names are recognized; outside of the namespace they’re unknown.
- The directive using namespace std; says that all the program statements that follow are within the std namespace.
- Various program components such as coutare declared within this namespace. If we didn’t use the using directive, we would need to add the stdname to many program elements. e.g.
- To avoid adding std:: dozens of times in programs we use the usingdirective instead.
Comments
Post a Comment