编程语言
首页 > 编程语言> > c++基础

c++基础

作者:互联网

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;
}

结果

 

标签:std,200,int,基础,atk,c++,运算符,作用域
来源: https://www.cnblogs.com/yifengs/p/15086322.html