What is a template?
Answers were Sorted based on User's Feedback
Answer / yughandhar
templates r used to create generic classes and functions.
Is This Answer Correct ? | 7 Yes | 0 No |
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 |
Answer / p suresh kumar
The template specifies a set of parameterized classes or
functions.
Is This Answer Correct ? | 7 Yes | 3 No |
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 |
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 |
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 |
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 |
Program to open a file with First argument
what uses of c++ language?
What is encapsulation in oops?
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
What is the significance of classes in oop?
is java purely oop Language?
49 Answers HCL, Infosys, TCS,
What is abstract class in oop?
What is overloading in oop?
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
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?
//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(); }