I have made a program that introduces a class, Inventory, that holds a given number of items introduced by the constructor. Observe:
Code:
class Inventory
{
public:
Inventory()
{
cItems=new Item[defaultSize];
suiCap=defaultSize;
}
Inventory(short unsigned int suiSize)
{
cItems=new Item[suiSize];
suiCap=suiSize;
}
~Inventory()
{
delete [] cItems;
}
Remove(short unsigned int suiIndex)
{
delete cItems[suiIndex];
}
protected:
Item* cItems;
short unsigned int suiCap;
private:
static short unsigned int siDefaultSize;
};
static int Inventory::siDefaultSize=32;
Inventory myInv(10);
What I am aiming to do is delete an individual member of the array. Is this possible? I have tried to delete it through my "Remove" function but...:
This gives me compiler errors, saying that Item * cannot be converted to void *.
So, any workaround to this?