May 2003
Intermediate to advanced
808 pages
32h 24m
English
using keyword — Looks up names in alternate classes or namespaces
block-decl := using-decl | using-directive
using-decl ::= using [typename] [::] nested-name :: unqualified-id ; |
using [::] unqualified-id ;
using-directive ::= using namespace [::] [nested-name ::] namespace-name ;The using keyword starts a
using declaration or using directive.
A using declaration
imports a name from another namespace into the current namespace. It
can also be used to introduce a name into a class scope; this is most
often used to promote the access level of an inherited member or bring
an inherited member into the derived class for overload
resolution.
A using directive
tells the compiler to search an additional namespace when looking up
unqualified names.
namespace math {
const long double pi = 3.1415926535897932385L;
};using math::pi;
long double tan(long double x = pi);
int main( )
{
using namespace std;
cout << "pi=" << math::pi << '\n';
}