#include #include // YOUR CODE HERE: 6 classes ! int main() { Written_Text* text[4]; int n = 0; // Some things that should give compilation error // new Hardback("Novik", "Temeraire", "sewn"); // new Book("Rowling", "Potter"); // new Paperback(); // new Textfile("Meyer"); text[n++] = new Book("Novik", "Temeraire", "sewn"); text[n++] = new Hardback("Rowling", "Potter"); text[n++] = new Paperback("Paolini", "Eragon"); text[n++] = new Magazine("Times company", "NY Times Magazine"); text[n++] = new Textfile("Meyer", "Midnight Sun", "PDF"); for (int i = 0; i < n; ++i) { std::cout << *text[i] << std::endl; } for (int i = 0; i < n; ++i) { const Written_Text* index = text[i]; std::cout << index->getTitle() << ", " << index->getAuthor(); const Book* b = dynamic_cast(index); if ( b != 0 ) std::cout << ", " << b->getBinding(); const Textfile* t = dynamic_cast(index); if ( t != 0 ) std::cout << ", " << t->getFormat(); std::cout << std::endl; } for (int i = 0; i < n; ++i) { delete text[i]; text[i] = 0; } return 0; }