Define Triple's Members Outside the Class
Define Triple's Members Outside the Class
Triple<A, B, C> is a class template with THREE type parameters whose constructor, getSecond and getThird are already written. Two members are only declared inside the class; define them OUTSIDE the class body:
- A getFirst() const: returns first
- void print() const: prints the three values separated by , (comma and space) followed by a newline
An out-of-class definition of a template member needs the full template prefix again, and the class name must carry its arguments: Triple<A, B, C>::. The tests print a Triple<int, double, char> holding 1, 2.5 and q, then its first value, then print a Triple<std::string, int, bool> holding id, 7 and true, and the sum of its second and third values, one line each.
Do NOT write a main function.
Expected Output:
1, 2.5, q 1 id, 7, 1 8
= newline. The output ends with a newline — print one after the last line.
Your Output
Run your code to see the output here...