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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!