Can a namespace
be nested in a class in C++?
Here is what I get with gcc-11.2.0:
struct C1 {}; // works
namespace N1 {const int a = 888;} // works
struct C2 { namespace N2 {const int a = 888;} };
// error: expected unqualified-id before ‘namespace’
Namespaces can be nested, so why can't one nest a namespace
in a class (which is also a kind of a namespace
)?