OOPortal
J2EEOnline RationalDB
prev next prev next
Course navigation
Lesson 4 The scope resolution operator and Binary form
Objective Binary form of the scope resolution operator.
The scope resolution operator's binary form is used to clarify names that are reused within classes.
class widgets { public: void f(); };
class gizmos  { public: void f(); };

void f() { ..... }          //ordinary external f
void widgets::f() { ..... } //f scoped to widgets
void gizmos::f() { ..... }  //f scoped to gizmos
Accessing Namespace Members Directly
Simply use the binary scope resolution operator with the namespace name on the left and the member on the right.
namespace A {
	intx = 1;
	structADT {
		enumColor { RED, WHITE, BLUE };
	};
}
namespace B {
	intx = 2;
	structADT {
		enumColor { GREEN, YELLOW };
	};
}
Course navigation