I am trying to initialize the variable count, which I declare in the class Count. However, I have tried doing it in multiple places in multiple ways and it does not work.
Count::Count() {
// why can't I say count = 0; here?
// Count::count = 0; doesn't work either.
Count::count = 0;
}
Just to explain some reasoning here: static variables exist independently of any instance of the class. So the initialization of the variable can't rely on the constructor for a particular object being called.