Others will not know because they haven't read your previous posts, and you haven't done your homework - you didn't go again through tutorials.
Do you know what scope is?
If you do something like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
int main(int argc, char* args[])
{//scope of main
if(something() )
{//scope of if
}
{//artificial scope
}
return 0;
}
|
At the end of every scope, variables are destroyed. If you do something like this:
1 2 3 4 5 6 7 8 9
|
do{
Inventory someInventory;
something();
}while(true);
|
someInventory will be:
1)created at the beggining of program
2)destroyed at the end of scope of do while loop
2) because while is true( constant bool here, but doesn't really matter), do while loop will loop again.
3) someInventory is created at the beggining of loop
4) again it's destroyed at the end of scope
5) steps 3-4 are repeated infinitely until while's condition is false.
You indeed fixed a few things, but not all. Again, you haven't really read things about constructors and other things too carefully. As you see, iHutch doesn't know what you mean, because what you said doesn't make sense.
And if you updated that bug and it isn't the case, then you should - again, as I adviced - go through your code and try to debug it yourself. I have no idea why are you learning programming, but I can tell you one thing for sure - lazy programmer is useless programmer. Unless you have will and strength to look through your code and try to understand before asking questions(if you are working on larger project, no one will ever debug your code), and you know what you are doing( if you aren't, you don't know programming language too well, and you should just read tutorials and/or lessons; eventually try to google something you don't understand/have problem with).
And start simple; If you are learning, you should learn on rather small programs(that can eventually grow into larger ones), because if you start building something big, and you lack of knowledge, you will make many mistakes which will make you angry or confused. To avoid it, start simple.
Edit: oh well, you inserted code. Now others will know:)
As I said, remember: this code has only 180 lines of code(and it's not full code), and reading it is already taking some time. If you make a project that consists of few header files, few .cpp files and main file, no one will ever try to guess what you are doing there. YOU should be your best debugger.
Cheers