October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Now you need to build a Stock constructor. Because a Stock object has three values to be provided from the outside world, you should give the constructor three arguments. (The fourth value, the total_val member, is calculated from shares and share_val, so you don’t have to provide it to the constructor.) Possibly, you may want to provide just the company member value and set the other values to zero; you can do this by using default arguments (see Chapter 8, “Adventures in Functions.”). Thus, the prototype would look like this:
// constructor prototype with some default argumentsStock(const string & co, long n = 0, double pr = 0.0);
The first argument is a pointer to the string that is used to initialize the ...
Read now
Unlock full access