类声明的名称的评价有这样的代码:秩序
#include <iostream>
const int c = 3;
struct A {
static int f() { return c; }
static const int c = 2;
};
int main() {
std::cout << A::f() << std::endl; // 2
return 0;
}
它是如何发生的变量c
定义内类A
在功能f
使用可变c
,而不是在全球范围内,虽然定义首先声明全局变量c
?