[comp.lang.c++] Member function static variables

carroll@cis.udel.edu (Mark Carroll) (10/11/90)

I've got a question concerning the status of static variables of
member functions. Does the function allocate one instance of the
static for each member of the class, or does it only allocate one
instance of the static?

Here's what I mean:
class A {
  public:
    int a();;
};

int A::a()
{
  static int k;
  k++;
  cout << k;
}

main()
{
  A b;
  A c;
  b.a();
  c.a();
}

What will this print out? 11, or 12?

	<MC>