Question: in C++ please Create a template class called SquareArr that has a pointer to Square as a private data member where T is the template

in C++ please

Create a template class called SquareArr that has a pointer to Square as a private data member where T is the template parameter. Let this pointer be pST. Another private data member you would need is sz of type size_t (size_t is an alias for unsigned int). a. Provide a default constructor that creates a dynamic array of 10 Squares and stores the pointer returned by the array version of new in pST. Initialize sz to 10. b. Provide a constructor that take a parameter _sz of type size_t and creates a dynamic array of that size and stores the pointer in pST and initializes sz to _sz. c. Provide a setsquare function that takes two parameters index of type size_t and side of type T. Inside the function check that index is less than sz and if true set the side of the Square object at index ix to side after checking side is positive. If there is an error, print an message and dont update anything. d. Provide a findMax member function that uses the global fimdMax in Figure 1.24 as is and (somehow) returns the max side value and the corresponding index.

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!