(go) What does the using namespace Std in C + + mean, when to use

Source: Internet
Author: User
Using the STD namespace

The C + + language after 98 provides a global namespace namespace that avoids the problem of causing global naming conflicts. To cite an instance, note the following two header files:

One.h
char func (char);
Class String {...};

Somelib.h
Class String {...};

If defined as described above, then these two header files cannot be included in the same program because the string class conflicts.
A namespace is a way to encapsulate the name of a library, which is like a fence in each library. Like what:
One.h
...

Baidu knows:
Is the meaning of the namespace, so that the compiler at compile time equivalent to each variable is a namespace + variable name, so that in different namespaces, the same variable name, to prevent the variable name exhaustion or conflict.

When do you use it?
When you want to use the standard Template Library for C + +, you need to use the using namespace std

(go) What does the using namespace Std in C + + mean, when to use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.