Scope Resolution Operator
Scope resolution Operator is define the function outside a class. it show the inside of program is :: .
for example :
Display of the progrma of using Scope resolution opreator(::) in the C++.
#include<iostream>
using namespace std;
int data=5; // global variable
main()
{
int data=6; //local variable
cout<<"without scope resolution opreator use in the data: "<<data<<endl;
cout<<"scope resolution opreator use in the data: "<< ::data<<endl;
}
output:
without scope resolution opreator use in the data: 6
scope resolution opreator use in the data : 5
Scope resolution Operator is define the function outside a class. it show the inside of program is :: .
for example :
Display of the progrma of using Scope resolution opreator(::) in the C++.
#include<iostream>
using namespace std;
int data=5; // global variable
main()
{
int data=6; //local variable
cout<<"without scope resolution opreator use in the data: "<<data<<endl;
cout<<"scope resolution opreator use in the data: "<< ::data<<endl;
}
output:
without scope resolution opreator use in the data: 6
scope resolution opreator use in the data : 5
No comments:
Post a Comment