C++ array of classes
- by nickik
I working on a game but I have a problem with the initialization of the level. (feld is just field in german)
class level{
private:
feld spielfeld[10][10];
public:
/*
other staff
*/
void init_feld();
};
void level::init_feld()
{
for(int i=0;i!=10;i++){
for(int n=0;n!=10;n++){
spielfeld[i][n] = new feld(land, i, n);
}
}
}
The Error:
Error: no match for »operator=« in »((level*)this)-level::spielfeld[i][n] = (operator new(24u), (, ((feld*))))« /home/nick/stratego/feld.h:18:11:
Remark: candidate is: feld& feld::operator=(const feld&) Process terminated with status 1 (0 minutes, 0 seconds) 2 errors, 0 warnings