Got two errors when compiling my program.
1 2 3 4 5 6 7 8 9
|
#include "Token.h"
#include <vector>
using namespace std;
class Grid
{
private:
vector<vector<Token*> > grid(6,7);
};
|
1 2
|
/Users/steve/Desktop/Connect 4/Grid.h:8: error: expected identifier before numeric constant
/Users/steve/Desktop/Connect 4/Grid.h:8: error: expected ',' or '...' before numeric constant
|
Any suggestions would be greatly appreciated.
Last edited on
You can also do that in a single line using an initializer list
1 2 3 4 5 6 7
|
class Grid
{
private:
vector<vector<Token*> > grid;
public:
Grid() : grid ( 6, vector<Token*>(7) ) {}
};
|
Last edited on
Ah. yeah good call. For whatever reason I didn't think of that XD
Constructors are as all other member functions so you can move their bodies from the header to a source file