Question: Create a class template called Generic Vector. The class should have the following members: a) Private Data Member: vec (a vector of type parameter). b)

Create a class template called Generic Vector. The class should have the following members: a) Private Data Member: vec (a vector of type parameter). b) Public Member Functions: push: This public function should accept an argument and insert its value at the end of the vector. last. This function should accept no argument and return the value of the last element of the vector. Print. This function will print all the elements in vector. c) After you have created the class template, develop a test program (containing main()) that will do the following: i. declare an object of Generic Vector where the type parameter will be replaced by double. ii. enter at least 3 double values into the vec data member of object created in (i). iii. in use the last function to print the last element of the object's vec data member. iv. use. the print function to print all elements of the object's vec data member. use a stream manipulator to ensure that 2 digits are printed after decimal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
