Templates in C++ || Write a code and return max value


 

A template is exmple of genereic programming , it is really powerful tool in C++. Idea is to pass data type as a parameter so code will not depent on data type.We need two  new keywords to support templates ‘template’ and ‘typename’. 

Max int :3     
Max in double :2.4
Max in alphabatical :b
Take three variable as input
Max :9
Max :1.4

0 Comments