Item object array and constructor
How can create 100 item object array with initializing constructor? I already tried a lot of ways but failed.
main.cpp
Create 100 item object array
Item.h
1 2 3 4 5 6 7
|
class Item
{
public:
Item();
Item(double sellPrice);
~Item();
};
|
Item.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
Item::Item()
{
}
Item::Item(double sellPrice)
{
}
Item::~Item()
{
}
|
I already know how to do it.
1 2 3 4 5 6 7
|
int main()
{
for (int i = 0; i < 100; i++)
{
item[i] = Item(1.1);
}
}
|
Topic archived. No new replies allowed.