Accessing static class variables in C++?

You must add the following line in the implementation file:

int Foo::bar = you_initial_value_here;

This is required so the compiler has a place for the static variable.

Leave a Comment