例如
struct A
{
static void foo();
static void foo(int);
static void foo(double, char);
...
};
并在范围内
namespace nm
{
using A::foo; // not right
}
如何将类中的静态名称引入范围?
答案 0 :(得分:1)
你不能。
n3376 7.3.3 / 8
类成员的使用声明应为成员声明。
struct X { int i; static int s; }; void f() { using X::i; // error: X::i is a class member // and this is not a member declaration. using X::s; // error: X::s is a class member //and this is not a member declaration.
}
n3376 7.3.3 / 3
在用作成员声明的using声明中,嵌套名称说明符应命名要定义的类的基类。