小编How*_*ard的帖子

在本地课程中访问问题

void foobar(){
    int local;
    static int value;
     class access{
           void foo(){
                local = 5; /* <-- Error here */
                value = 10;
           }
     }bar;    
}   
void main(){
  foobar();
}
Run Code Online (Sandbox Code Playgroud)

为什么不进入local内部foo()编译?OTOH我可以轻松访问和修改静态变量value.

c++ scope local-class

5
推荐指数
0
解决办法
514
查看次数

标签 统计

c++ ×1

local-class ×1

scope ×1