Technical Discussion :: C++
Home > Freshers > Technical Interview Questions > C++
24. What is function templates?
Answer:
Like class template, we can also define function templates that would be used to create a family of function with different argument types.
Syntax:
Template
return type function name(argument of type T)
{
………..
//body of function
//with type T
//wherever appropriate
}
We must use the template parameter T as and when necessary in the function body and in its arguments list.
Asked In :: Sopra Steria
Like class template, we can also define function templates that would be used to create a family of function with different argument types.
Syntax:
Template
return type function name(argument of type T)
{
………..
//body of function
//with type T
//wherever appropriate
}
We must use the template parameter T as and when necessary in the function body and in its arguments list.
Syntax:
Template
return type function name(argument of type T)
{
………..
//body of function
//with type T
//wherever appropriate
}
We must use the template parameter T as and when necessary in the function body and in its arguments list.