Do static local variables in a class persist between objects?

Posted by user144182 on Stack Overflow See other posts from Stack Overflow or by user144182
Published on 2010-06-10T17:14:35Z Indexed on 2010/06/10 17:22 UTC
Read the original article Hit count: 239

Filed under:
|
|
class MyClass
{
  static int staticInt;

  void instanceMethod( int param )
  {
    static int parameter = param;
  }
}

Clearly staticInt is shared between all instance of MyClass. But can different instances of MyClass have different values of parameter the static local variable within instaceMethod?

© Stack Overflow or respective owner

Related posts about c++

Related posts about static