August 2002
Beginner
1122 pages
22h 1m
English
Now let's continue with our analysis of the class interface for the StockItem class (Figure 6.3 on page 312). Before we can do anything with a StockItem object, we have to enter the inventory data for that object. This means that we need another constructor that actually sets the values into a StockItem. We also need some way to display the data for a StockItem on the screen, which means writing a Display function.
The next line of that figure is the declaration of the “normal” constructor that creates an object with actual data:
StockItem(std::string Name, short InStock, short Price, std::string Distributor, std: :string UPC);
We can tell that this function is a constructor because its name, StockItem ...
Read now
Unlock full access