Hi,
What is wrong with this?
It can't find X1, "error: `X1' is not a class or namespace". Why?
What is wrong with this?
Code:
#include <stdio.h>
struct X { // or class X { public:
static int f();
};
int f(void) {
static int x = 0;
x++;
return x;
}
int main(void) {
X X1;
int j;
for (j = 0; j < 5; j++) {
printf("value of f(x) is: %d\n", X1::f()); // or X1.f()
}
return 0;
}
It can't find X1, "error: `X1' is not a class or namespace". Why?