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 does sksksk mean in text slang?

1547


#include #include #include #include void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

2077


c++ program to swap the objects of two different classes

1770


Why is static class not inherited?

601


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

1647






what are the different types of qualifier in java?

1847


What is multilevel inheritance in oop?

562


What is advantage of inheritance?

696


What does no cap mean?

600


what is the sylabus for priliminaries?

1697


What is abstraction in oop?

644


What is the point of polymorphism?

598


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

1844


What are the benefits of polymorphism?

630


What are the advantages of polymorphism?

579