An array of functions?
I know this has been asked before, but this is a slightly different question.
I know i can do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
int itemList[5][5] {
{ item.damage(), 5, 8, 12, 9}
};
class item
}
public:
int damage()
{
return 5;
}
} item;
void function()
{
cout << itemList[0][0];
}
|
and it will return 5.
However, i need to do the same thing, but with statements:]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
int itemList[5][6] {
{ item.damage(), 5, 8, 12, 9, item.use()}
};
class item
}
public:
int damage()
{
return 5;
}
} item;
void useItem(int IDnumber)
{
itemList[IDnumber][5];
}
void function()
{
cout << itemList[0][0];
useItem(0);
}
|
please explain it in words what you want really to do ?
Topic archived. No new replies allowed.