Just started a programming class this semester, and haven't been having much trouble with it thus far. However, after writing around five classes without a problem earlier, this one has been giving me trouble. I keep getting errors C2228 and C2065 on lines 108-111. This is my first class that uses two constructors, so my guess is there's some sort of syntax error related to that. Any help would be greatly appreciated.
Inventory item1 (itemNumber, quantity, cost);
This is being defined inside of an if statement so it has local scope there and can not be used outside of that block of code (in between the braces). This applies for the object created in the else statement as well.
You may want to look up "Local/Global Variable Scope" on some C++ topics to understand why this is happening.
You could use dynamic memory/pointers to create the object in either of the blocks but in this case I would just define your starting variables equal to 0 and then use the same constructor after both choices.