注意点:访问全局变量,变量名重复时,用限定符“::”; int a{ 10 }; int main() { int a{ 20 }; std::cout << a << std::endl; //a = 20; std::cout << ::a << std::endl; //a = 10; }