-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha5_book.cpp
More file actions
57 lines (46 loc) · 1.22 KB
/
Copy patha5_book.cpp
File metadata and controls
57 lines (46 loc) · 1.22 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include "a5_book.hpp"
using namespace std;
// PURPOSE: Class that models a book
/*
CONSTRUCTORS
*/
// Parametric constructor with all attributes specified
Book::Book(string new_title, string new_authors, string new_dop) :
book_title(new_title),
book_authors(new_authors),
date_of_publication(new_dop) {}
// PURPOSE: Parametric constructor with title and authors only
Book::Book(string new_title, string new_authors) :
book_title(new_title),
book_authors(new_authors),
date_of_publication("N/A") {}
// PURPOSE: Parametric constructor with title only
Book::Book(string new_title) :
book_title(new_title),
book_authors("N/A"),
date_of_publication("N/A") {}
// PURPOSE: Default constructor
Book::Book() :
book_title("N/A"),
book_authors("N/A"),
date_of_publication("N/A") {}
/*
GETTERS
*/
// Service function that outputs all attribute value
void Book::print() {
cout << book_title << " "
<< book_authors << " "
<< date_of_publication << endl;
}
// accessor methods for member attributes
string Book::get_title() {
return book_title;
}
string Book::get_authors() {
return book_authors;
}
string Book::get_dop() {
return date_of_publication;
}