您好,登录后才能下订单哦!
密码登录
            
            
            
            
        登录注册
            
            
            
        点击 登录注册 即表示同意《亿速云用户服务条款》
        把做工程过程中经常用的内容段珍藏起来,下边资料是关于C++演示在不同的范围内不冲突使用同名变量的范例的内容。
#include <iostream>
using std::cout;
using std::endl;
{
    public:
};
{
}
{
    return x;
}
int main()
{
    abc a;
    cout << "Scope within class abc:  x = " << a.x
         << "nScope within namespace def:  x = " << def::x
         << "nScope within function getx:  x = " << getx()
         << "nScope within global scope :  x = " << ::x
         << "nScope within local main function:  x = " << x;
         {
             cout << "nScope within local code block:  x = " << x;
         }
    return 0;
}
Scope within class abc:  x = 10
Scope within namespace def:  x = 20
Scope within function getx:  x = 30
Scope within global scope :  x = 40
Scope within local main function:  x = 50
Scope within local code block:  x = 60
													免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。