Классы полка и книга. Класс обработчик размещает книги согласно коду на нужную полку, поиск книг с заданными атрибутами на полках. #include <iostream> #include <string> typedef std::string str; class Book { private: str m_genre; str m_author; str m_name; int m_str; int m_year; double m_price; public: Book( str genre = "Not specified genre.", str author = "Not specified genre.", str name = "Not specified name.", int year = 0, int str = 0, double price = 0 ) : m_genre(genre), m_author(author), m_name(name), m_year(year), m_str(str), m_price(price) {} const str& getGenre() const { return m_genre; } const str& getAuthor() const { return m_author; } const str& getName() const { return m_name; } const int& getYear() const { return m_year; } const int& getStr() const { return m_str; } const double& getPrice() const { return m_price; } void setGenre(const str& genre) { m_genre = genre; } void setAuthor(const str& author) { m_author = author; } void setName(const str& name) { m_name = name; } void setYear(const int& year) { m_year = year; } void setStr(const int& str) { m_year = str; } void setPrice(const double& price) { m_price = price; } void show() const { std::cout << m_genre << "\n" << m_author << "\n" << m_name << "\n" << m_year << "\n" << m_str << "\n$" << m_price << "\n\n"; } }; class Bookshelf { private: int number; str bookname; }; int main() { Book book1; book1.show(); Book book2("Horror", "Stephen King", "Misery", 1987, 5, 9.99); book2.show(); return 0; } Код #include <iostream> #include <string> typedef std::string str; class Book { private: str m_genre; str m_author; str m_name; int m_str; int m_year; double m_price; public: Book( str genre = "Not specified genre.", str author = "Not specified genre.", str name = "Not specified name.", int year = 0, int str = 0, double price = 0 ) : m_genre(genre), m_author(author), m_name(name), m_year(year), m_str(str), m_price(price) {} const str& getGenre() const { return m_genre; } const str& getAuthor() const { return m_author; } const str& getName() const { return m_name; } const int& getYear() const { return m_year; } const int& getStr() const { return m_str; } const double& getPrice() const { return m_price; } void setGenre(const str& genre) { m_genre = genre; } void setAuthor(const str& author) { m_author = author; } void setName(const str& name) { m_name = name; } void setYear(const int& year) { m_year = year; } void setStr(const int& str) { m_year = str; } void setPrice(const double& price) { m_price = price; } void show() const { std::cout << m_genre << "\n" << m_author << "\n" << m_name << "\n" << m_year << "\n" << m_str << "\n$" << m_price << "\n\n"; } }; class Bookshelf { private: int number; str bookname; }; int main() { Book book1; book1.show(); Book book2("Horror", "Stephen King", "Misery", 1987, 5, 9.99); book2.show(); return 0; } Есть такой код как сделать полку, наверное с помощью агрегации, но не понимаю какими свойствами может обладать полка, какие атрибуты если она только хранит книгу, номер полки и количество одинаковых книг?