Question: #include Console.h #include Item.cpp #include class Inventory { / * * TODO: Define three member fields * = = = = = =

#include "Console.h"
#include "Item.cpp"
#include
class Inventory
{
/*
* TODO: Define three member fields
*=================================
*- An int called mMaxSize
*- An vector of Items called mItems
*- An int called mGold
*/
//Member fields for MaxSize, Items, and Gold
private:
int mMaxSize; //Initilizing field for MaxSize called mMaxSize
std::vectormItems; //Initilizing field for Items as a vector called mItems
int mGold; //Initilizing field for Gold called mGold
public:
/*
* TODO: Write a default constructor
*======================================
* By default, it should:
*- Assigns the mMaxSize to 10,
*- Assign mItems to a new vector of Items with mMaxSize as the size
*- Set mGold to 50.
*/
//default constructor
Inventory()
{
mMaxSize =10; //setting default for mMaxSize equal to 10
mItems = std::vector(mMaxSize); //setting default for mItems as a new vector with the size that is for mMaxSize
mGold =50; //setting default for mGold equal to 50
}
// TODO: Create a Getter and a Setter for the mGold field named "GetGold" and "SetGold"
//setting up mGold accessor
int GetGold()
{
return mGold; //return mGold
}
//setting up mGold mutator
int SetGold(int gold)
{
mGold = gold; //setting default mGold equal to gold
}
/* TODO: Write a method called AddItem
*======================================
* The method should return a bool returns
* a bool and takes an Item parameter.
*
* This method should iterate through the
* mItems vector, looking for any vector element
* that is default.
*
* If a default Item is found, it should assign
* that vector element to the Item passed in and
* return true. Otherwise it should return false.
*/

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!