Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a templated version of the class Collection with the template parameters: Obj, F1, F2. (a) The templated class Collection and all the templated functions
Write a templated version of the class Collection with the template parameters: Obj, F1, F2. (a) The templated class Collection and all the templated functions should be in the header file collection.h (there is no collection.cpp file in this assignment). You have to transfer all the function definitions from collection.cpp (from previous part) to collection.h (except the input operator>>). (b) Replace the class Stress_ball as (typename) Obj, Stress_ball_colors as F1, and Stress_ball_sizes as F2. You are given a file, Stress_ball_test.cpp. Complete this file by filling dots (...) such that it can be used with the templated Collection class. In order not to use long class names, use aliases: using Collection SB Collection; (c) The input operator>> can be templated but you need to use a specific version for each template class. So for the class Stress_ball use this approach: istream& operator>>(istream& is, Collection SB & c); where you explicitly use the class Stress_ball (do not use the template parameters Obj, F1, or F2). And do not put it in the file Collection.h but put it in the file Stress_ball_test.cpp . (d) Use the same Stress_ball class created in the previous parts of the assignment.,>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started