Hello everyone. I recently changed from Visual Basic to Eclipse and I'm having a hard time getting used to this new IDE >_< (Nope, I didn't choose it).
Sometimes it detects unexistent errors which disappear after I restart Eclipse or when I coment/uncoment the code itself.
Therefore, I'm not sure whether the following piece of code is correct or not (even tho it considers it to be an error and I don't know why).
Code:
class Frota {
vector<Vehicle *> vehicles;
public:
int lowestYear() const;
};
int Frota::lowestYear() const{
int lowestYear = 2014;
vector<Vehicle *>::iterator it;
int year = (*it)->getYear(); //getYear is a method from another class
if (vehicles.size() != 0) {
for (it = vehicles.begin(); it != vehicles.end(); ++it) { //The error lies on this line of code
if (year < lowestYear) {
lowestYear = ano;
}
}
return lowestYear;
}
return 0;
}
Error: no match for 'operator=' (operand types are .....) etc etc.
There isn't much I can say about it. I've done several iterators before, I don't understand why would the for loop be incorrect.
Any input is welcome.