Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Programming/Scope/Examples/Program Namespaces

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

// Namespaces Program, an example to illustrate the use of namespaces #include <iostream> namespace first { int first1; int x; } namespace second { int second1; int x; } namespace first { int first2; } int main(){ //first1 = 1; first::first1 = 1; using namespace first; first1 = 1; x = 1; second::x = 1; using namespace second; //x = 1; first::x = 1; second::x = 1; first2 = 1; //cout << 'X'; std::cout << 'X'; using namespace std; cout << 'X'; return 0; }