Topic: question about using directives and using declaration
Author: Michael Greenberg <mgreenberg@scr.siemens.com>
Date: 1998/10/15 Raw View
In the standard (section 7.3.3 para 8) the following is given:
Definitions added to the namespace after the using-declaration are not
considered when a use of the name is made:
namespace A { void f(int); }
using A::f;
namespace A { void f(char); }
void foo()
{ f('a'); } // calls f(int)
In 7.3.5 para 5 (part of the example is removed)
namespace D { void f(char) ; }
using namespace D;
namespace D { void f(int); int d2;}
void f() { f('a'); // calls f(char)
d2++; // OK
}
What the rationale for the difference in behavior between the
using-directive and the using-declaration?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]