Tuesday, November 2, 2010

Using Directives

The following code compiles:

   namespace A
   {
      int a = 5;
      namespace B
      {
         int b = a;
      }
   }
   int main()
   {
      return A::B::b;
   }

This is trying to show that the statement inside of namespace B, sees the symbols in namespace A.

No comments:

Post a Comment