Thursday, December 13, 2012

scope resolution operator in c++


#include<iostream.h>
#include<conio.h>
int b=100;
void main()
{
clrscr();
int b=50;
{
int bh=b;
int b=25;
cout<<"we are in the inner block";
cout<<"bh="<<bh<<"\n";
cout<<"b="<<b<<"\n";
cout<<"::b="<<::b<<"\n";
}
cout<<"\nwe are int the outer block\n";
cout<<"b="<<b<<"\n";
cout<<"::b"<<::b<<"\n";
getch();
}

Output