// namespace-main-3-4.cpp By: Aiman Hanna © 1993 - 2004 // This program illustrates how namespaces can be used. // The program fixes the problems that namespace-main-1-2.cpp has. // Key points: 1) namespace #include "namespace3.h" #include "namespace4.h" int main() { region3::Calc1 c1(30), c11(45);; c1.setValue(32); region4::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 region4::dup.setValue(c1); cout << "The value of object \"dup\" has been set to : " << region4::dup.getValue() << endl; region3::dup(c1, c11); cout << "The value of object \"c1\" has been set to : " << c1.getValue() << endl; return 0; } // The result of running the program /* 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 */