class Book{
public:
string _title;
string _author;
string _publisher;
Date _published;
float _price;
string _isbn;
int _page;
int _copies;
Book(void);
Book(string, string, string, Date, float, string, int, int);
};
Book::Book(void)
{
_title = "";
_author = "";
_publisher = "";
_published = 0;
_price = 0;
_isbn = "";
_page = 0;
_copies = 0;
Where Date is a class including ints for day, month, and year. This generates a no viable overloaded = error.
int main(void)
{
LinkedList myList;
ifstream myFile("sample.txt");
string title;
string author;
string publisher;
Date published;
float price;
string isbn;
int page;
int copies;
while( myFile )
{
getline(myFile,title);
getline(myFile,author);
getline(myFile,publisher);
getline(myFile,published);
getline(myFile,price);
getline(myFile,isbn);
getline(myFile,page);
getline(myFile,copies);
myList.insert_rear(new Book(title,author,publisher,published,price,isbn,page,copies));
}
myList.print_list();
return 0;
}
For getline published(Date class), price(int), page(int), and copies(int) I'm getting a no matching function call for getline. I know getline is for strings so I expected that error. What can I do instead?
Thank you, and if you need to see more code let me know.