Template yang berlebihan di CPP
// we can overload template just like function
/*if the template function have same name but differ by
signaturas (number of parameters and their type and their sequence)
then the are said to be overloaded.*/
/*here print function can be used to print a single value or the same value
multiple times depending upon the parameters passed*/
template <class T>
T print (T a)
{
cout << a;
}
template <class T>
T print (T a, int n)
{
for (int i=0; i<n; i++)
{
cout << a;
}
}
int main()
{
print('a');
print(1);
print(1,6);
}
Sleep deprived