A template in C++ is used to pass data types as parameters . These make it easier and more simpler to use classes and functions.
template <typename T>
int fun (T a,T b)
{
return (a+b);
}
int main(){
cout<<fun<int>(11,22);
}
Posted Date:- 2021-08-24 04:49:27
Which is the best C++ compiler?
Which operator cannot be overloaded in C++ ?
What differences separate structure from a class in C++?
Can we provide one default constructor for our class?
What is the default constructor?
Is it possible for a C++ program to be compiled without the main() function?
What Is A Unnitialised Pointer?
What Is The Disadvantage Of Using A Macro?
What Do You Mean By Global Variables?
What are logical error and how does it differ from syntax error?
How to run C++ program in cmd?
Explain the significance of vTable and vptr in C++ and how the compiler deals with them
Can we declare variable anywhare in c ?
Control Statements or Control Flow ?
How to download turbo C++ for windows 10?
What is operator overloading in C++?
Can we use a continue statement without using a loop?
What is the difference between the text file and a binary file?
What is the importance of an algorithm in C programming?
Can we have a recursive inline function in C++?
What is the function of the keyword “Volatile�
Briefly explain the concept of Inheritance in C++.
Can we call C++ OOPS? and Why?
What are the User-defined Functions?
What are the Pre-defined Functions?
What are the differences between references and pointers?
What are the differences between C and C++?
What Are Structures And Unions?
Types of errors in c?
Errors in c programming are divid