-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.cpp
More file actions
22 lines (18 loc) · 681 Bytes
/
Book.cpp
File metadata and controls
22 lines (18 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "Book.h"
#include <iostream>
Book::Book(int id, std::string title, std::string author) {
this->id = id;
this->title = title;
this->author = author;
this->isAvailable = true;
}
int Book::getId() const { return id; }
std::string Book::getTitle() const { return title; }
std::string Book::getAuthor() const { return author; }
bool Book::getStatus() const { return isAvailable; }
void Book::setStatus(bool status) { isAvailable = status; }
void Book::displayBook() const {
std::cout << "ID: " << id << " | Title: " << title
<< " | Author: " << author
<< " | Status: " << (isAvailable ? "Available" : "Borrowed") << "\n";
}