int main ()
{
int a =10;
{
int a = ::a; // this is giving error how to fix this??
a =20
cout<<"a :"<<a<<endl; this should print a = 20;
cout<<"A : "<<::a<<endl; this chould print A =10;
}
}
You can't do that. Inner "a" declaration shadows outer "a" declaration. There is
no way in this case to tell the compiler which "a" you want; it will assume the inner
one in the inner block.