May 12, 2004
// Static variable in template member changes only one time.

class A {
  void foo() {
    static int x = 0;
    x++;
    printf("%d", x);
  }
}
class B(T) {
  void foo() {
    static int x = 0;
    x++;
    printf("%d", x);
  }
}
void main() {
  A a = new A(); B!(int) b = new B!(int)();
  a.foo(); a.foo(); a.foo(); printf("\n"); // outputs 123
  b.foo(); b.foo(); b.foo(); printf("\n"); // outputs 111
}

// If declare 'static int x = 0' in class (or template) scope, 'B' output is "123".