Originally Posted by
Elysia
You sure that the ONLY error you get?
NOOOO! that was the first, but now got different ones after modifications...
First, modifications
Code:
void Car::read(istream& indata, Car& car, bool isKeyboard) // removed const before car
{
Date dates; // added
indata >> car;
if(isKeyboard) {
readDates(dates); // changed argument from stream to dates
}
}
New errors...
1.
Code:
// Overload for enum variable when writing data
ostream& operator << (ostream& out, Car::TankStatus enumTStatus)
{
out << reinterpret_cast<int&>(enumTStatus);
return out;
}
// Error 1
: error C2084: function 'std::ostream &operator <<(std::ostream &,Car::TankStatus)' already has a body
2.
Code:
// Ouput the data to screen or file
void Car::write(ostream& out, bool isScreen, Date& date)
{
if(isScreen) // To the output screen
{
out << setw(6) << make << setw(8) << model;
out << setw(10) << yearModel;
out << setw(12) << engineCapacity;
out << setw(9) << date.day << setw(3) << date.month << setw (5) << date.year;
out << setw(13) << getTankStatusName(tankStatus).c_str();
puts("");
}
else // To the file
{
out << " " << make << " " << model;
out << " " << yearModel;
out << " " << engineCapacity;
out << " " << returnDate.day << " " << returnDate.month << " " << returnDate.year;
out << " " << tankStatus;
}
}
// Error 2
: error C2511: 'void Car::write(std::ostream &,bool,Date &)' : overloaded member function not found in 'Car'
i'll pause here...
EDIT: Picked up some of my probs in red, and, am not using getters where am suppose to