Class Definition:
class A {
public:
int a;
static int b;
A(int x) { a = x; }
void changeA(int x) { a = x; }
int getA() { return a; }
};
This wouldn't work:
A::b = 5; //This is outside the class definition and outside main
The error is:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Do note that I'm not initializing it inside the class body.
Aucun commentaire:
Enregistrer un commentaire