Advertisement
desislava_topuzakova

Untitled

Jun 10th, 2020
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1. // Library.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <iostream>
  5. #include <ostream>
  6. #include <string>
  7.  
  8. const std::string filename = "Output.dat";
  9.  
  10. using namespace std;
  11.  
  12. class Book {
  13. private:
  14.     string author_name, date;
  15.     bool is_available;
  16. public:
  17.     Book(string author_name, string date, bool is_available);
  18.     Book();
  19.     Book(const Book& other);
  20.  
  21.     string get_author_name() const;
  22.     void set_author_name(string author_name);
  23.  
  24.     string get_date() const;
  25.     void set_date(string date);
  26.  
  27.     bool get_is_available() const;
  28.     void set_is_available(bool is_available);
  29.  
  30.     void set_book(string author_name, string date, bool is_available);
  31.     string toString();
  32.  
  33.     friend ostream& operator<<(ostream& stream, const Book& other);
  34. };
  35. Book::Book(string author_name, string date, bool is_available) :
  36.     author_name(author_name), date(date), is_available(is_available) {
  37.  
  38. }
  39.  
  40. Book::Book(const Book& other): author_name(other.author_name), date(other.date), is_available(other.is_available) {
  41.  
  42. }
  43.  
  44. Book::Book() : author_name(""), date(""), is_available(NULL) {
  45.  
  46. }
  47.  
  48. string Book::get_author_name() const {
  49.     return this->author_name;
  50. }
  51.  
  52. void Book::set_author_name(string author_name) {
  53.     this->author_name = author_name;
  54. }
  55.  
  56. string Book::get_date() const {
  57.     return this->date;
  58. }
  59.  
  60. void Book::set_date(string date) {
  61.     this->date = date;
  62. }
  63.  
  64. bool Book::get_is_available() const {
  65.     return this->is_available;
  66. }
  67.  
  68. void Book::set_is_available(bool is_available) {
  69.     this->is_available = is_available;
  70. }
  71.  
  72. void Book::set_book(string author_name, string date, bool is_available) {
  73.     this->author_name = author_name;
  74.     this->date = date;
  75.     this->is_available = is_available;
  76. }
  77.  
  78. class Library {
  79. protected:
  80.     int count_books;
  81.     Book books [];
  82.  
  83.    
  84. };
  85.  
  86. int main()
  87. {
  88.    
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement