h*****g 发帖数: 312 | 1 namespace {static int n;}
namespace A{
namespace {static int n}
}
using namespace A;
int main()
{
n = 5;
return 0;
};
Referring to the sample code above, which one of the following statements is
true?
A.
There is nothing wrong with the sample code.
B.
Unnamed namespaces are illegal.
C.
Nested namespaces are illegal.
D.
Nested namespaces that are unnamed are illegal.
E.
The reference to n is ambiguous.
此题为啥选E? | t****t 发帖数: 387 | 2 因为A里面有n,同时A外面的anonymouse namespace 也有n,又有using namespace A,这
样就不知道究竟是指的哪个n | f****4 发帖数: 1359 | 3 你这样的题目能放在一个帖子里面求解答么?
这又不是灌水~
【在 h*****g 的大作中提到】 : namespace {static int n;} : namespace A{ : namespace {static int n} : } : using namespace A; : int main() : { : n = 5; : return 0; : };
|
|