After running the following code segment, the output is

Outer.
Inner.
Inner.

#include <iostream>
  using namespace std;
  namespace Outer
  { 
     void message( );
     namespace inner
     {  
       void  message( );
     }
  }
 int main( )
 { 
    Outer::message( );
    Outer::Inner::message( );

    using namespace Outer;
    Inner::message( );

    return 0;
  }

    namespace Outer
  {   

      void message( )
      { 
         cout<< "Outer.\n";
      }
     namespace Inner
        { 
            void message( )
           {
             cout << "Inner.\n";
            }
         }
        }

I know this is about the usage of "namespace", but do not understand why the call of "Inner::message()" print out "Inner". Thanks for explanation.

lines 14 and 17 are just showing you two different ways to do the exact same thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.