I have the following C++ classes.
xyz.h
class xyz {
public:
static int abc();
};
qwe.h
#include xyz.h
namespace xyz {
class qwe{
public:
void bnm() {
int value = xyz::abc();
}
};
}
How do I access xyz::abc() here. I get a compilation error here saying abc is not a member of xyz. I understand the reason that it’s trying to search for the abc method inside this xyz namespace whereas what it should ideally get is a static method in the xyz class.
Is there a way to get around this without changing the namespace names?
Don’t make a class with the same name as a namespace (or its own namespace for that matter).