i have this array class that i need to make it so instead of being restricted to just ints it can take anykind of variable. here is the code for the class
class array
{public:
int & operator [] (int); //Prototype; overloaded operator
int size ()
{return ub-lb + 1;
};
int lbound ()
{return lb;
};
int ubound ()
{return ub;
};
array (int, int); //User specifies subscripts
array (int); //User specifies number of elements
array (); //Default constructor
private:
int *list; //Dynamic array
int lb; //Lower bound of array; set by user
int ub; //Upper bound of array; set by user
};
we are supposed to use a template or something and i tried making one that took different types as parameters but i couldn't get it to work so im not sure if thats was the right path