:: without a namespace

:: in ::CGContextRef means global namespace, which means CGContextRef is defined in the global namespace.

int x = 10; 
namespace test
{
    int x = 100;
    void f() 
    {
         std::cout << x << std::endl;  //prints 100
         std::cout << ::x << std::endl; //prints 10
    }     
}

See complete demo here : http://www.ideone.com/LM8uo

Leave a Comment