Book.cpp 516 B

1234567891011121314151617181920212223
  1. #include <string>
  2. #include "Book.h"
  3. Book::Book(){ // default constructor
  4. title = ""; // no title
  5. author = ""; // no author
  6. pageNum = 0; // zero pages
  7. } // makes "books" without pages
  8. Book::Book(std::string title, int pageNum){ // useful constructor
  9. this->title = title; // set title
  10. this->pageNum = pageNum; // set number of pages
  11. author = ""; // still no author
  12. }
  13. std::string Book::getTitle(){ // get the book's title
  14. return title;
  15. }
  16. int Book::getPageNum(){ // get the number of pages
  17. return pageNum;
  18. }