Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q3: Define overloading operator Book- (10 points) 3.1In Book class, define opera

ID: 3717619 • Letter: Q

Question

Q3: Define overloading operator Book- (10 points) 3.1In Book class, define operator-overloading function that assigns (copies) one Book object's data members into another book object. So *(ContainerObject1 -> book) - *(ContainerObject2 -> book); will copy ContainerObject1 data members to ContainerObject2 using the operator- overloading function.

Explanation / Answer

int Book::operator+(Book *other) { return getNoOfBooks() + other->getNoOfBooks(); } int Book::operator+(int book_count) { return book_count + getNoOfBooks(); } Book &Book::operator=(const Book &other) { name = other.name; noOfbooks = other.noOfbooks; libNumber = other.libNumber; pubDate = other.pubDate; return *this; }