TITLE: "entering and leaving" namespaces (Newsgroups: comp.lang.c++.moderated, 15 Oct 96) PROBLEM: olczyk@interaccess.com (Thaddeus L. Olczyk) By now most C++ programmers know that to use a namespace you use the statement using namespace mynamespace. But is there a way to stop using a namespace? Something like !using namespace mynamespace. RESPONSE: clamage@taumet.Eng.Sun.COM (Steve Clamage) You don't "enter" a namespace with using namespace mynamespace; You enter a namespace with namespace mynamespace { and you leave it with } The using-directive makes the declarations in the namespace visible without qualifiers in the current scope. To make qualification required again, you exit the current scope. Example: { using namespace mynamespace; // members of mynamespace can be used without qualifiers ... } // members of mynamespace require qualifiers ... C++ does not provide a mechanism for "undeclaring" a name in the same scope where it was declared.