I am trying to whip out a template program, and the compiler yells at me when i try to declare the contents of an array inside the public/private areas of the class:
Code:
template <class T>
class myclass
{
public:
T a[7];
void showarray(T);
private:
int numarray[]={3,5,9,2,1};
char charray[]={'a','e','i','o','u'};
string starray[]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
it has a problem with the '{' character of each array. but if i got rid of the content declaration {3,5,9,2,1} then it accepted the array. i need the arrays to be passed to the a[7] array (eventually).
i tried initializing the array in the main() but it wouldnt pass the values.
is there a better way to get the values into the a[7] array?