What is a scope operator?
What is a scope operator?
its the 2 colons next to each other. when you define a class member function its like this:
the :: indicates that myfunction is limited to being used by instances of myclass.Code:void myclass::myfunction( ) { blah; blah; blah; }
Also if you have a global and local identifier it can be used to distinguish them:
Hope that helps....Code:int var = 10; void main( ) { int var = 20; cout << "global variable = " << ::var << endl; //prints 10 cout << "local variable = " << var << endl; //prints 20 }
Also, you can access member functions of a class without declaring an object of that class (Like ios::binary), provided they're declared as static of course.