Question: in c + + / / TODO: Define three member fields / / An int called mMaxSize / / An array of Items called mItems

in c++
// TODO: Define three member fields
// An int called mMaxSize
// An array of Items called mItems
// An int called mGold
// TODO: Write a default constructor that assigns the mMaxSize to 10,
// mItems to a new array of Items with mMaxSize as the size,
// and mGold to 50.
// TODO: Write a C# property for mGold called Gold (it has to
// access/update the mGold member field).
// TODO: Write a method called AddItem that returns a bool and takes an Item parameter.
// This method should iterate through the mItems array, looking for any array element
// that is null. If a null Item is found, it should assign that array element to the
// Item passed in and return true. Otherwise it should return false.
// TODO: Write a method called RemoveItem that returns a bool and takes a string parameter.
// This method should iterate through the mItems array, looking for an Item that
// has the same name as the parameter. If it finds a match it should set that
// element of the mItems array to null and return true. Otherwise return false.
// Do not forget to make sure the element is not null before checking its name.
// TODO: Write a method called GetItem that returns an Item and takes a string parameter.
// This method should iterate through the mItems array, looking for an Item that
// has the same name as the parameter. If it finds a match it should return that element
// of the mItems array. Otherwise return null.
// Do not forget to make sure the element is not null before checking its name.

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 Programming Questions!