in template prototype
whats the diffirence b/w class and typename
?
here why is template <class T> ???? whats the purpose of it ?Code:1 // Fig. 6.26: maximum.h 2 // Definition of function template maximum. 3 4 template < class T > // or template< typename T > 5 T maximum( T value1, T value2, T value3 ) 6 { 7 T maximumValue = value1; // assume value1 is maximum 8 9 // determine whether value2 is greater than maximumValue 10 if ( value2 > maximumValue ) 11 maximumValue = value2; 12 13 // determine whether value3 is greater than maximumValue 14 if ( value3 > maximumValue ) 15 maximumValue = value3; 16 17 return maximumValue; 18 } // end function template maximum



LinkBack URL
About LinkBacks


