1 #include "lib_static_init.h" 2 #include <stdio.h> 3 Foo()4Foo::Foo() 5 { 6 /* increment the static variable */ 7 value = ++Foo::counter; 8 fprintf(stderr, "Foo::Foo for this=%p called (counter = %d)\n", this, counter); 9 } 10 getValue()11int Foo::getValue() 12 { 13 return value; 14 } 15 16 int Foo::counter; 17 18 Foo theFoo; 19