What is a template?

Answers were Sorted based on User's Feedback



What is a template?..

Answer / yughandhar

templates r used to create generic classes and functions.

Is This Answer Correct ?    7 Yes 0 No

What is a template?..

Answer / 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

What is a template?..

Answer / p suresh kumar

The template specifies a set of parameterized classes or
functions.

Is This Answer Correct ?    7 Yes 3 No

What is a template?..

Answer / yughandhar

Templates is one of the features added to c++ recently.a
template can be considered as a kind of macro.
Templates are mainely used for creating the generic classes

Is This Answer Correct ?    3 Yes 0 No

What is a template?..

Answer / debika mohapatra

Templates is one of the features added to c++ recently.a
template can be considered as a kind of macro.

Is This Answer Correct ?    2 Yes 0 No

What is a template?..

Answer / rakesh kumar

Templates is one of the features added to c++ recently.a
template can be considered as a kind of macro.
Templates are mainely used for creating the generic classes

Is This Answer Correct ?    1 Yes 1 No

What is a template?..

Answer / yughandhar

template is a kind of macro to create generic classes and
generic functions to do a specific task

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

Program to open a file with First argument

1 Answers   TCS,


what uses of c++ language?

3 Answers  


What is encapsulation in oops?

0 Answers  


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

0 Answers  


What is the significance of classes in oop?

0 Answers  






is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


What is abstract class in oop?

0 Answers  


What is overloading in oop?

0 Answers  


Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345

7 Answers  


what is difference b/w object based and object oriented programming language?

18 Answers   Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,


What is the important feature of inheritance?

0 Answers   BPL,


//what is wrong with the programme?? #include<iostream.h> template <class first> class dd { first i; public: void set(); void print(); }; void dd< first>:: set() { cin>>i; } void dd< first>::print() { cout<<"\n"<<i; } void main() { dd <char>g; g.set(); g.print(); }

1 Answers  


Categories