J
John Watson
I can find no error w/ the code below but g++ complains that:
22: error: multiple types in one declaration
22 class Group;
23
24 class Cell{
25 public:
26 uint val;
27 Group *group;
28 Cell();
29 Cell(uint inval, Group *g);
30 };
31
32 class Group{
33 uint val;
34 vector<Cell *> members;
35 public:
36 Group(uint in); //: val(in) {}
37 void swap(Group *newGroup);
38 void add(Cell *inCell); //{ members.push_back(inCell);}
39 uint value(); // {return val;}
40 };
I need to forward declare class Group for class Cell to have a pointer to
that class. Does anyone know how to deal with two classes referencing
eachother?
Thanks,
John
22: error: multiple types in one declaration
22 class Group;
23
24 class Cell{
25 public:
26 uint val;
27 Group *group;
28 Cell();
29 Cell(uint inval, Group *g);
30 };
31
32 class Group{
33 uint val;
34 vector<Cell *> members;
35 public:
36 Group(uint in); //: val(in) {}
37 void swap(Group *newGroup);
38 void add(Cell *inCell); //{ members.push_back(inCell);}
39 uint value(); // {return val;}
40 };
I need to forward declare class Group for class Cell to have a pointer to
that class. Does anyone know how to deal with two classes referencing
eachother?
Thanks,
John