cout << name << " with ID " << id << " created." << endl;
Item(string _name, int _id)
name = _name;
id = _id;
void FindItem(int id)
/* This takes the parameter and uses a loop to look through
all of the Item class objects. But how...? */
Item * rock = new Item("Rock", ITEM_ROCK);
Item * stone = new Item("Stone", ITEM_STONE);
int itemid = rock->getid();
I want to, like the comment says, use an id as a parameter for a function that can look through all of the class's objects in search of the given id. I just don't know how that can be done.
P.S: I don't want to use an array of class objects. They suck.