Yes, this is a newbie question, and yes, I do expect to get flamed for it. I'm not really understanding the whole structure of classes, declaring variables inside of them, etc. I know that this source code is (duh) incorrect and won't compile. I would like if someone could rewrite the code so it is correct and compiles, and to further advance my learning of the language.
Fire away.Code:#include <stdafx.h> #include <cmath> #include <iostream> using namespace std; class box { static food; food = 4 } int main () { cout<<"The box has "<< box::food<< "pieces of food in it"; return 0; }



LinkBack URL
About LinkBacks



)