Advertisement
Neveles

Untitled

Dec 1st, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.71 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef BOOKINTHELIBRARY_H
  4. #define BOOKINTHELIBRARY_H
  5. #include <iostream>
  6. #include <fstream>
  7. #include "MyString.h"
  8. #include <string>
  9.  
  10. using namespace std;
  11.  
  12. class BookInTheLibrary
  13. {
  14. private:
  15.     // поля
  16.     string author_;
  17.     string title_;
  18.     unsigned int publishingYear_;
  19.     string discipline_;
  20.     unsigned int numberOfCopies_;
  21. public:
  22.     // перегрузка оператора присваивания
  23.     BookInTheLibrary& operator= (const BookInTheLibrary& ob);
  24.  
  25.     // перегрузка бинарных операторов
  26.     BookInTheLibrary operator+ (unsigned int value);
  27.     BookInTheLibrary operator- (unsigned int value);
  28.  
  29.     // перегрузка операторов отношения
  30.     bool operator== (const BookInTheLibrary& ob) const;
  31.     bool operator> (const BookInTheLibrary& ob) const;
  32.     bool operator< (const BookInTheLibrary& ob) const;
  33.     bool operator>= (const BookInTheLibrary& ob) const;
  34.     bool operator<= (const BookInTheLibrary& ob) const;
  35.  
  36.     // перегрузка операторов инкремента/декремента
  37.     BookInTheLibrary& operator++();
  38.     BookInTheLibrary& operator--();
  39.  
  40.     // конструкторы/деструктор
  41.     BookInTheLibrary();
  42.     BookInTheLibrary(string author, string title, unsigned int publishingYear,
  43.         string discipline, unsigned int numberOfCopies);
  44.     BookInTheLibrary(unsigned int numberOfCopies);
  45.     BookInTheLibrary(const BookInTheLibrary& ob);
  46.     ~BookInTheLibrary();
  47.  
  48.     // перегрузка операторов ввода/вывода через дружественные функции
  49.     friend ostream& operator<< (ostream& out, const BookInTheLibrary& ob);
  50.     friend istream& operator>> (istream& in, BookInTheLibrary& ob);
  51. };
  52.  
  53. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement