Question: Design a class named NumberClass that has a vector of any data type (use Class Template). You should create a parameterized constructor that accept the
Design a class named NumberClass that has a vector of any data type (use Class Template). You should create a parameterized constructor that accept the initialization value for the vector.
There should also be member functions to perform the following operations: - Print (cout) each element stored in the vector. -
#include <iostream>
#include <vector>
using namespace std;
//create code here
int main() {
NumberClass<int> myNum({99,34,12,44,77,2,37,4,54,68, 44, 102, 5, 42});
cout << "Print the elements in the vector" << endl;
myNum.printNumber();
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
Lets proceed with the task of designing a class template in C as per the requirements The class will be named NumberClass and it will include a parame... View full answer

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