sematic scope: static variable in CPP with explicit namespacing

My apologies if this has been brought up here before.

Here is my sample code, class.cpp

1
2
3
4
5
6
7

static int xx;

namespace app{
  class yy{};
}


My questions is what is the scope of xx here? Is it any difference than the one without namespace app{}? Possible answer:
1. xx is global (probably not)
2. only object from yy can see xx


What about the zz in this one?

1
2
3
4
5
6
7
8

static int xx;

namespace app{
  static int zz;
  class yy{};
}
Last edited on
Topic archived. No new replies allowed.