Hey all,
I want to add a vector to my inventory class so that it can hold whichever item data type is passed in. I'm having trouble with setting the size of the vector so that I can put items in it. Here's my code.. Whenever I run it I get output 0, meaning the size of the vector isn't registering.. any help is appreciated.
class inventory
{
public:
vector <Potion*> potions;
inventory(int index) : potions (index)
{
}
};
int main()
{
ePotion energy_potion;
inventory bag(4);
bag.potions.assign(0, &energy_potion);
cout << bag.potions.size();
cin.get();
return 0;
}