My program crashes when it tries to assign one object to the other, do you guy see anything wrong with this?
The variables are:
Field *fields[50];
int numOfFields;
int currentField;
The function is:
Screen& operator=(Screen &scr) {
if (this != &scr){
for (int i = 0; i < 50; i++)
fields[i] = NULL;
for (int i = 0; i < scr.numOfFields; i++)
fields[i] = scr.fields[i];
numOfFields = scr.numOfFields;
currentField = scr.currentField;
}
return *this;
}