M
Martin T.
Hello.
Is a static Variable in a member function of a class static with regard
to one object, or is it static for all objects of the class?
That is:
best regards,
Martin
Is a static Variable in a member function of a class static with regard
to one object, or is it static for all objects of the class?
That is:
Code:
class A {
// ...
void func() {
static int x = 0;
x++;
printf("static x = %d", x);
}
//...
};
//...
A obj1;
B obj1;
obj1.func(); // should print 1
obj2.func(); // does this print 1 or 2 ??
best regards,
Martin