作用域运算符“::”
一、(作用域 ):: 《作用域中的某个成员》 = 或 比较? 或者 ->给某个对象。
#if 0
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int g_number = 100;
void test01()
{
int g_number = 200;
cout << g_number << endl;
// 打印作用于 全局的变量
cout << ::g_number << endl;
}
class MyClass{
public:
const static int a = 10;
};
void test02(){
cout << MyClass::a << endl;//某个函数作用域的内的东西访问出来
/* 底层实现机制不清楚 */
}
int main(){
test01();
system("pause");
return EXIT_SUCCESS;
}
#endif