Question: Please help in the context of C++ programming, as you developp your solutions to each question kindly explain key concepts as you develop your solution



Please help in the context of C++ programming, as you developp your solutions to each question kindly explain key concepts as you develop your solution
Figure 2 for (e): Client code a) Given the code in the figurel, it is only possible to construct a Book and DVD by specifying the total number of copies: auto b= Book\{"The Great Gatsby", "F.Scott Fitzgerald", 4\}; auto d= DVD\{"Star Wars: Episode V - The Empire Strikes", 124, 3\}; Provide all modifications to the above code to also allow for the construction of these library items without specifying the total number of copies, as shown below. auto b2 = Book\{"Advanced Control Engineering", "Roland S Burns" }; auto d2= DVD\{"Avengers: Endgame", 182\}; By default, the total number of copies must be set to one, and the number of copies-onloan to zero. You must make use of in-class ini- tializers. [5marks] b) Add functionality to the Libraryitem class which allows the total number of all library items on loan, at any point in time, to be tracked and queried. [5 marks] c) Refactor the class hierarchy to use composition instead of inheritance. The client code, which is given in FIGURE2 and use the existing hierarchy, must be able to use the refactored code without having to be modified. [8marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
