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?
Update
What about between program executions? Certainly they could be different in multiple program instances? What defines "scope" there - the execution unit? The c++ runtime?
Update
Thanks - this helped me squash a critical bug. Wish I could accept them all, but I'm going with the first answer with no other criteria.
There is exactly one instance of parameter
.
If you want an instance of parameter
for each instance of the class, use a nonstatic member variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With