I'm a noob who is just starting with programming and I was wondering why do I get an error message which says: invalid use of non-static data member 'Lavirint::n'?
class Lavirint{
private:
int n, m;
bool mapa[n + 2][m + 2]; //is this valid?
...
}
Edit - I added a few other variables to the same line, but they don't cause the more errors.
n
andm
? If you want to do this, declaremapa
asbool **mapa;
and then allocate the memory for it in the constructor.