
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















void printArray(int* array, int size) { for ( int i = 0; i < size; i++ ) cout << array[ i ] << “, ”; }
void printArray(double* array, int size) { for ( int i = 0; i < size; i++ ) cout << array[ i ] << “, ”; }
class Array { double* pArray; int size; public: … };
class Array { bool* pArray; int size; public: … };
template< class T > void funName( T x ); // OR template< typename T > void funName( T x ); // OR template< class T, class U, … > void funName( T x, U y, … );
int main() { int iArray[5] = { 1, 2, 3, 4, 5 }; void printArray( iArray, 5 ); // Instantiated for int[] char cArray[3] = { ‘a’, ‘b’, ‘c’ }; void printArray( cArray, 3 ); // Instantiated for char[] return 0; }
template
int main() { int x; x = getInput< int >(); double y; y = getInput< double >(); }