Assume having a C++ class. And there’s a namespace which should be visible only inside my class. What to do for that?
class SomeClass
{
using namespace SomeSpace;
public:
void Method1();
void Method2();
void Method3();
};
namespace SomeSpace
{
/*some code*/
};
using namespace X;is called a using directive and it can appear only in namespace and function scope, but not class scope. So what you’re trying to do is not possible in C++. The best you could do is write the using directive in the scope of the namespace of that class, which may not be desirable.On second thought, though, analyzing your words,
I’d suggest something like the following, which I am not sure is what you want.