What is a template?

Answer Posted / ravinandan

Template is used for generic programming. In other words
when you want to write a function or a class type
independent, go for templates.

template<class T>
void fun(T x, T y); // Is a Template function

template<typename T>
class abc{
T m;
}; // Is a Class Template

template<class T>
class abc{
T m;
}; // Is a Class Template

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the realtime excercises in C++?

2431


when to use 'mutable' keyword and when to use 'const cast' in c++

1746


Can abstract class have normal methods?

684


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1731


What is protected in oop?

693






write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

1882


is there any choice in opting subjects like 4 out of 7

1822


What is encapsulation c#?

696


What is the real life example of polymorphism?

712


What is static modifier?

710


What is the point of oop?

743


explain sub-type and sub class? atleast u have differ it into 4 points?

1933


What is difference between pop and oop?

701


Can we override main method?

686


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1242