template function
//模板1
template < class T >
void printArray ( T * a, int m ) //attention: the star before a
{
for( int i = 0; i < m ; i++ )
cout << a[i];
}
//模板2
template < class T >
void printArray ( T a , int m ) // no star
{
for ( int i = 0; i < m; i++ )
cout << a[i];
}
// test
void main()
{
int a[] = { 1, 2, 3, 4, 5 }
printArray ( a, 5 );
}
? 究竟T 为何类型