I just started getting into templates.I am trying to code this so it supports all data types instead of just int. i know what i did is wrong for sure. please show me how to do this. thanks
1 2 3 4 5 6 7 8 9 10
T & myArray < T >::operator[](int index) {
if (index >= start && index <= end) {
return (array[index - start]);
}
cout << "Error: Index out of bound" << endl;
exit(1);
}