Hello, the following code is displaying the error to the right:
#include <iostream>
using namespace std;
class teste {
static int x;
public:
teste () {
x++;
}
} t1;
int main () {
return 0;
}
I declare the static variable int, and in the constructor method I increment +1, but the following error occurs.
How to solve?
NOTE: In the book I'm reading the code is like that too.