Originally Posted by
Darryl
I'd like to see the car.Read() function, my guess is that it is returning false and so fleet.push_back is never getting called.
Even if you you don't have a custom copy constructor(but needed one), the default constructor will push something back, so it shouldn't be empty.
Code:
// Read fleet data from either keyboard or file
bool Car::Read(istream& indata)
{
if ( !(indata >> *this) )
return false;
return true;
}
// Overload for reading input file streams
istream& operator>>(istream& in, Car& car)
{
string make, model, regNo;
int ymodel, engCap;
Car::TankStatus ts;
in >> make >> model;
in >> regNo;
in >> ymodel;
in >> engCap;
in >> ts;
// Ensure correct tank details
if ( (ts>3) || (ts<0) ) {
ts=Car::unknown;
}
car.setCarDetails(make, model, regNo, ymodel, engCap, ts);
return in;
}