C ++ Chapter 11

C ++ Chapter 11

C ++ Chapter 11
Assign04_Start/.DS_Store __MACOSX/Assign04_Start/._.DS_Store Assign04_Start/Assignment Instructions.doc For this assignment: Use an int template nontype parameter "numberOfElements" and a type parameter "elementType" to create a template for the Array class we studied in Chapter 11. This template will enable Array objects to be instantiated with a specified number of elements of a specified element type at compile time. To prepare for this assignment, review the Array class case study from Chapter 11 of the text. You should also review section 14.5 of the text. Because the nontype parameter "numberOfElements" specifies the number of elements in the array, you should now include as a data member of the template class an array of the appropriate size and type. You should no longer use the new operator (in the ctor) and the delete operator (in the dtor) to dynamically create and destroy the array. In addition: - do NOT try to convert the overloaded << and >> operators into template functions. You will likely find this difficult to do. Instead, provide for inputArray() and outputArray() member functions for your template Array class. - add a static member to your Array template class called arrayCount which will count how many instantiations of a specialization of the Array template class currently exist. You should also provide a static member function called getArrayCount() that will return the current value of arrayCount for a specialization of the Array template class. - because you will be removing the use of the new and delete operators from your solution, the copy ctor and the overloaded assignment operator are no longer necessary. You may remove them from your solution. - do _NOT_ attempt to initialize the elements of the Array in the ctor. This is difficult to do because your code must work no matter what type is plugged into your template class and unnecessary because the elements will be initialized by the default ctor of whatever type they.