Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Find an equation of the given line. Slope is -2; x-intercept is -2

Answered: 1 week ago

Question

Present your fi ndings to the class.

Answered: 1 week ago