Question: Create a class template to store a partially filled array. The class will store an array of up to 10 items of any type. You

 Create a class template to store a partially filled array. The

Create a class template to store a partially filled array. The class will store an array of up to 10 items of any type. You will statically allocate a 10 item array of template type T and then use an integer variable to specify how much of the array is actually in use at the current point in time (the effective size): 0 2 7 8 Effective Size - 7 Remember, your entire template class will be written in the header file because template classes can't be split into header and implementation files. Your class should have the following template member functions: Default Constructor - initializes the effective size to zero (since the array starts out with nothing in it) but does NOT initialize the array. * * print : displays the contents of the partially filled array (you can choose how to separate the items, e.g. by endlines, spaces, commas, etc) add1lement adds the item passed in as a parameter to the end of the array and adjusts the effective size to match. If the array is already full then it ignores the new item and leaves the array unchanged. reroveElement: is passed an index as a parameter and removes the item at that index from the array and shifts all the remaining items down to the right, so that the array doesn't have a gap in it - don't forget to update the effective size. largest: should return the largest item in the partially-filled array. ' In main,(), you should: Create a partially filled array of whatever type you choose, e.g, ints, strings, doubles. NOTE: The syntax for creating an object from the template would look something like: PFarray arr; assuming that you named your class PFahra and you wanted to create an object from the template using the type double. Call all of the functions you have written on the array. Find one type of variable of which you cannot create a partially-filled array (hint: look at the code in print and largest). Why can't you create a partially-filled array of that type

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!