以下是一些代码:
class aclass {
int x = 1;
static float peanut; //definition not allowed here or in any other class
};
float aclass::peanut = 5.2; //definition seems to only be allowed at file scope
int main() {
//definition of peanut not allowed here
return 0;
}
那么为什么不允许在块中定义peanut
,例如函数或类?