Tell me what are the syntax and semantics for a function template?
Submitted by: AdministratorTemplates is one of the features of C++. Using templates, C++ provides a support for generic programming.
We can define a template for a function that can help us create multiple versions for different data types.
A function template is similar to a class template and it syntax is as follows:
template <class T>
Return-type functionName (arguments of type T)
{
//Body of function with type T wherever appropriate
}
Submitted by: Administrator
We can define a template for a function that can help us create multiple versions for different data types.
A function template is similar to a class template and it syntax is as follows:
template <class T>
Return-type functionName (arguments of type T)
{
//Body of function with type T wherever appropriate
}
Submitted by: Administrator
Read Online C++ Template Job Interview Questions And Answers
Top C++ Template Questions
☺ | What is Template class? |
☺ | What is Cass template? |
☺ | Please tell me how is static data member similar to a global variable? |
☺ | Tell us what is the STL, standard template library? |
☺ | What is Class element in C++? |
Top C Plus Plus Language Categories
☺ | C++ Pointers & Functions Interview Questions. |
☺ | C++ Operator Overloading Interview Questions. |
☺ | C++ Exception Handling Interview Questions. |
☺ | C++ Virtual Functions Interview Questions. |
☺ | C++ Template Interview Questions. |