1.::作用域运算符
::双冒号为全局运算符
#include <iostream> using namespace std; int atk = 200; void Test() { int atk = 100; cout << "Test内部:" << atk << endl; cout << "Test外部:" << ::atk << endl; } int main() { Test(); system("Pause"); return EXIT_SUCCESS; }
结果