I tried to declare a static data member in the header file of my class (Square). I got the following error:
Square.cpp:13: error: expected unqualified-id before ‘int’
Square.cpp: In function ‘int numFilled()’:
Square.cpp:91: error: ‘squaresSolved’ was not declared in this scope
#ifndef SQUARE_H
#define SQUARE_H
usingnamespace std;
class Square
{
public:
Square();
~Square();
staticint squaresSolved;
voidoperator = ( constint other );
void checkSquare(const Square other);
void checkOnly();
bool checkPoss();
int blockRowInit(int);
int blockColInit(int);
int numFilled();
private:
bool m_isSolved;
int m_Solution;
int m_Possibilities[9];
int m_numPossibilities;
};
I don't understand where/how to declare and initialize it properly.... I looked in my textbook, and I could not find anything helpful. I also looked on the internet, but I could not find anything I could understand.