// namespace-main-9-10.cpp By: Aiman Hanna - ©1993-2006 Aiman Hanna // This program illustrates namespaces aliases. // Key points: 1) Namespace aliases #include "namespace10.h" int main() { // Have a shorter aliases for our namespaces. Notice that the aliases are // different from the ones used in the other cpp files (namespace9.cpp & // namespace10.cpp) namespace rg3 = region3; namespace rg4 = region4; namespace rg31 = region3::region31; namespace rg32 = region3::region31::region32; namespace rg33 = region3::region31::region32::region33; rg3::Greeting(); rg3::Calc1 c1(30), c11(45);; c1.setValue(32); rg4::Calc2 c2; c2.setValue(c1); cout << "The value of object \"c2\" has been set to : " << c2.getValue() << endl; // use the global object - set it to the same value as c1 rg4::dup.setValue(c1); cout << "The value of object \"dup\" has been set to : " << rg4::dup.getValue() << endl; rg3::dup(c1, c11); cout << "The value of object \"c1\" has been set to : " << c1.getValue() << endl; cout << "\n\n==============================================\n"; rg31::message1(); rg32::message2(); rg33::message3(); cout << "==============================================\n"; return 0; } // The result of running the program /* Hello from region 3. The value of object "c2" has been set to : 32 The value of object "dup" has been set to : 32 The value of object "c1" has been set to : 45 ============================================== Hello...there...That looks better; isn't it? ============================================== */