Question: C++ struct Item string name; int quantity; float cost; const int MAX_SIZE = 50; class Manage Inventory { public: ManageInventory() : count{0}, p_pInventory Items (new

C++
struct Item string name; int quantity; float cost; const int MAX_SIZE = 50; class Manage Inventory { public: ManageInventory() : count{0}, p_pInventory Items (new Item*[size}} { } Manage Inventory(int size) : size{size}, count{0}, p_pInventoryItems (new Item*[size}} { } Manage Inventory(); void addItem(string name, int quantity, float cost); private: int size {MAX_SIZE}; int count; Item ** p_pInventoryItems; 1. Write the definition for addItem. Use the new operator to dynamically create instances of type Item. Store pointers to inventory items in the inventoryItems array. 2. Write the ManageInventory class destructor definition. Use the delete operator to dynamically destroy all Item objs stored in the inventoryItems array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
