Hi I keep getting these errors (using g++ on UNIX)...
vehicle_array.cc: In member function `void
vehicle_array::remove_reg(vehicle_reg&)':
vehicle_array.cc:72: error: no match for `vehicle_reg& == vehicle_reg&'
operator
vehicle_array.cc:79: error: name lookup of `i' changed for new ISO `for'
scoping
vehicle_array.cc:71: error: using obsolete binding at `i'
Here's the snipet of code it is referring to:
Our instructor told us that the == operator was already overloaded for classes. Is this true? It seems to not be working in this case. I also understand this code is sorta messy, sorry. Any help would be appreciated though.Code:void vehicle_array::remove_reg(vehicle_reg& tmp){ bool ctrl = false; for(int i = 0; i < used; i++){ //line 71 if(veh_arr[i] == tmp){ //line 72 ctrl = true; break; } } if(ctrl){ for(i ; i < used; i++){ //line 79 veh_arr[i] = veh_arr[i + 1]; } used--; } }