C
C++ Shark
Hi, the following doesn't compile.
#include<iostream>
#include<vector>
using namespace std;
class tile_type {
vector<vector<int> > grid(3, vector<int> (3));
public:
};
int main()
{
tile_type k;
return 0;
}
The compiler (g++) says:
tile.cpp:5: invalid data member initialization
tile.cpp:5: (use `=' to initialize static data members)
make: *** [tile] Error 1
I am trying to make an object with an array, so that I can access
k.grid[][]. I am using Dietel & Dietel's book, and though I looked it
over, I couldn't find a right way of doing this type of thing. I hope
you can tell me the correct method.
thanking you,
Craig.
#include<iostream>
#include<vector>
using namespace std;
class tile_type {
vector<vector<int> > grid(3, vector<int> (3));
public:
};
int main()
{
tile_type k;
return 0;
}
The compiler (g++) says:
tile.cpp:5: invalid data member initialization
tile.cpp:5: (use `=' to initialize static data members)
make: *** [tile] Error 1
I am trying to make an object with an array, so that I can access
k.grid[][]. I am using Dietel & Dietel's book, and though I looked it
over, I couldn't find a right way of doing this type of thing. I hope
you can tell me the correct method.
thanking you,
Craig.