I am getting an error in my << overloaded function of my book class that I do not understand here is some code snippits:
the errors:Code:void Book::printAuthors(const vector<Author> & tempauthors){ vector<Author>::const_iterator constIterator; for (constIterator=tempauthors.begin(); constIterator!=tempauthors.end(); ++constIterator) cout << *constIterator<<endl; } ostream &operator<<(ostream & os,const Book & tBook){ os << "\nTitle: "<<tBook.get_title()<<'\n'; os << "Publisher: "<<tBook.get_publisher()<<'\n'; os << "Authors: "<<'\n'; tBook.printAuthors(tBook.authors); os << endl; return os; }
ook.cpp: In function `std::ostream& operator<<(std::ostream&, const Book&)':
book.cpp:90: passing `const Book' as `this' argument of `void
Book::printAuthors(const std::vector<Author, std::allocator<Author> >&)'
discards qualifiers



LinkBack URL
About LinkBacks


