#include <stdio.h>

class sample {
  // note, private protection is default
  static int a = 0; // note that only static members can be initialized
                    // this way; normal members should be initialized in
                    // the constructor
  int b;
public:
  sample() { a++; b=0;  printf("STARTING: a=%d, b=%d\n", a, b); }
  ~sample() { printf("FINISHED: a=%d, b=%d\n", a, b); a--; b--; }
};

// memory for the static member must be defined somewhere!
// you could also initialize "a" here instead of in the class
int sample::a;

main()
{
  sample s1;
  sample s2;
  sample s3;
}
