#include <iostream>
namespace X
{
int k = 8;
}
int main()
{
using namespace X;
int k = 0;
std::cout << k;
return 0;
}
我正在努力理解合格查找和非合格查找之间的区别,以及它们如何处理使用命名空间;短语
现在,我想澄清一下?这里的 k 会导致合格查找吗?
最佳答案
For an unqualified name, that is a name that does not appear to the right of a scope resolution operator ::, name lookup examines the scopes as described below, until it finds at least one declaration of any kind, at which time the lookup stops and no further scopes are examined.
as k
没有出现在范围解析运算符的右侧。
关于c++ - 这是 C++ 中的不合格查找吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48359294/