Question: Create a class Book, with separate interface and implementation, comprised of the following attributes: **You should have separate files for class definition and implementation: Book.h
Create a class Book, with separate interface and implementation, comprised of the following attributes:
**You should have separate files for class definition and implementation: Book.h and Book.cpp
| Data members (private): | |
| string: title |
|
| string: author |
|
| Member functions (public): | |
| Default constructor | Sets both title and author to empty strings |
| Parameterized constructor | Takes two strings for initializing title and author, in this order |
| getTitle() | Returns title as a string |
| setTitle(string) | (void) Assigns title the value of the input string |
| getAuthor() | Returns author as a string |
| setAuthor(string) | (void) Assigns author the value of the input string |
It is advisable to write your own test cases for each class. Test your class in Cloud9 before submitting to the autograder, as the autograder has a submission limit of 20 tries.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
