Static members belong to the class itself, not to individual objects. class Counter { static int count; }; means there's one count variable shared by all Counter objects.
Access static variables through the class name: Counter::count = 0; count,
Static member functions can only access other static members. static int getCount() { return count; } works, but static void show() { cout << speed; } fails because speed belongs to instances, not the class.