Code:
#include <iostream>
using namespace std;
int i=5;//Global variable
class ABC
{
public:
void show()
{
int i=20;//local block declaration
cout<<i;
cout<<“\nGlobal variable:”<<::i;
}
};
int main()
{
ABC obj1;
obj1.show();
return 0;
}
Output:
20
Global variable:5