Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 918 Bytes

7.42.md

File metadata and controls

39 lines (31 loc) · 918 Bytes

(a) Book

class Book {
public:
  //Book() : isbn(""), name(""), author(),
  //    publish_year(0), publisher(""), version(0) {}
  Book() : Book("", "", std::vector<std::string>(), 0, "", 0) {}
  Book(const std::string &i, const std::string &n,
       const std::vector<std::string> &au,
       unsigned y, const std::string &p = "", unsigned v = 1)
      : isbn(i), name(n), author(au),
        publish_year(y), publisher(p), version(v) {}
  Book(std::istream &is) {
    is >> isbn >> name;
    std::string s;
    is >> s;
    author.push_back(s);
    is >> publish_year >> publisher >> version;
  }

private:
  std::string isbn;
  std::string name;
  std::vector<std::string> author;
  unsigned publish_year;
  std::string publisher;
  unsigned version;
};

(b) Date

(c) Employee

(d) Vehicle

(e) Object

(f) Tree