class Library{
public:
void add_book(Book);
void add_patron(Patron);
void book_out(Book, Patron);
struct Transaction{
Transaction(Book, Patron, Date);
Book book;
Patron patron;
Date date;
};
private:
vector<Transaction> trans;
vector<Book> books;
vector<Patron> patrons;
};
And I want to make a constructor for Transaction.
I figured this should work:
1 2 3 4
Library::Transaction::Transaction(Book b, Patron p, Date d)
{
}
However, I'm getting an error that there is no default constructor available for Book, Patron and Date(error c2512). I know how to fix this, by defining a default constructor for these classes. But why is this necessary? I'm not creating an object in the function's argument list, right?
This is hurting my brain, before I created a constructor for Transaction everything was fine. I didn't have a default constructor for vector<Book>, but I didn't get an error for that.