Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ template

template <class  T>//or <typename T> it´s the same
 //T can be int, float, double, etc. 
//simple use example: 
T sum(T a, T b)
{
  return a + b;
}
sum(5.0f, 10f);//sum using float
sum(2,3);//sum using int
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #template
ADD COMMENT
Topic
Name
9+6 =