October 1999
Beginner
304 pages
7h 11m
English
Let’s say that a colleague of ours has asked for three additional display_message() instances to handle a vector of integers, a vector of doubles, and a vector of strings:
void display_message( const string&, const vector<int>& ); void display_message( const string&, const vector<double>& ); void display_message( const string&, const vector<string>& );
On completing the implementation of these three instances, we notice that the function body for each instance is exactly the same. The only difference across these functions is the type of the second parameter: [3]
[3] A more flexible implementation adds a third parameter of type ostream that by default is set to cout:
void display_message( const string&, ...
Read now
Unlock full access