-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha5_book.cpp
More file actions
31 lines (23 loc) · 712 Bytes
/
a5_book.cpp
File metadata and controls
31 lines (23 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// a5_book.cpp
// Book class
#include "a5.h"
using namespace std;
// default constructor
Book::Book()
:name(""), author(""), year(0), genre(""), num_pages(0)
{}
// constructor
Book::Book(string n, string a, int y, string g, int p)
:name(n), author(a), year(y), genre(g), num_pages(p)
{}
// copy constructor
Book::Book(const Book & other)
:Book(other.name, other.author, other.year, other.genre, other.num_pages)
{}
// getters:
Book Book::get_book() {return *this;}
string Book::get_name() const {return name;}
string Book::get_author() const {return author;}
int Book::get_year() const {return year;}
string Book::get_genre() const {return genre;}
int Book::get_num_pages() const {return num_pages;}