Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CODING IN C++ Media Audio Book Periodical CD Tape Magazine Newspaper Newsletter Create just the complete interface and the main method files for the following
CODING IN C++
Media Audio Book Periodical CD Tape Magazine Newspaper Newsletter Create just the complete interface and the main method files for the following class hierarchy. Consider the following constraints. 1. The Magazine class should have characteristics of both the Book and Periodical classes. The public and protected attributes of Book should remain public and protected in the Magazine class respectively whereas the public attributes of Periodical should become protected in Magazine class. 2. The Media class should have an integer attribute no_of_users that is only directly accessible within the Media class. 3. The Audio class should have audio_id and audio_type attributes that are accessible within the class itself as well as in the CD and Tape classes. 4. The Periodical class should have periodical_id and periodical_name attributes that can be accessible in any class. 5. There should be a play function prototype in Audio, CD and Tape classes. The Audio class should be an abstract base class and the CD and Tape should be concrete derived classes. 6. There should be a print function prototype in Periodical, Newspaper and Newsletter classes. 7. There should be a broadcast function prototype in all the classes. 8. The classes should be related in such a way that public members of Audio class should become protected members of the CD and Tape classes. 9. The public members of Periodical class should become public members of the Newsletter and Newspaper classes. 10. In the main meth create two generic handlers of the Periodical base class to call the specialized objects of the Magazine and the Newsletter classes respectively. Then, call the print function of the Newsletter class in main. 11. Finally, call the Periodical base class destructor in the main method and set such a logic in the interface such that not only the Periodical destructor is called through it but the Newsletter and Magazine classes destructors are also called. Media Audio Book Periodical CD Tape Magazine Newspaper Newsletter Create just the complete interface and the main method files for the following class hierarchy. Consider the following constraints. 1. The Magazine class should have characteristics of both the Book and Periodical classes. The public and protected attributes of Book should remain public and protected in the Magazine class respectively whereas the public attributes of Periodical should become protected in Magazine class. 2. The Media class should have an integer attribute no_of_users that is only directly accessible within the Media class. 3. The Audio class should have audio_id and audio_type attributes that are accessible within the class itself as well as in the CD and Tape classes. 4. The Periodical class should have periodical_id and periodical_name attributes that can be accessible in any class. 5. There should be a play function prototype in Audio, CD and Tape classes. The Audio class should be an abstract base class and the CD and Tape should be concrete derived classes. 6. There should be a print function prototype in Periodical, Newspaper and Newsletter classes. 7. There should be a broadcast function prototype in all the classes. 8. The classes should be related in such a way that public members of Audio class should become protected members of the CD and Tape classes. 9. The public members of Periodical class should become public members of the Newsletter and Newspaper classes. 10. In the main meth create two generic handlers of the Periodical base class to call the specialized objects of the Magazine and the Newsletter classes respectively. Then, call the print function of the Newsletter class in main. 11. Finally, call the Periodical base class destructor in the main method and set such a logic in the interface such that not only the Periodical destructor is called through it but the Newsletter and Magazine classes destructors are also calledStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started