devxlogo

Namespace Members Have Static Storage

Namespace Members Have Static Storage

Variables and objects defined within a namespace have static storage type. As such, namespace members are by default initialized to binary zeros before program’s outset. Likewise, namespace members are destroyed after program’s termination:

 namespace mine{  int n; //automatically initialized to 0 before program's outset  std::string str("abc"); // str will be destroyed after program's termination}

devx-admin

Share the Post: