Here is some code:
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;
}
So why is peanut
not allowed to be defined inside a block, such as functions or classes?