Tuesday, November 2, 2010

Using Declarations

The following code does not compile:

  namespace A {
    static const int a = 5;
    namespace B {
      static const int b = a;
  using A::b;
  int c = b;
  int main()
    return c;

Because b is not in namespace a. If the using declaration was 'using A::B::b' then it would compile.

No comments:

Post a Comment