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 |
what is the main difference between sizeof() operator in c and c++
which is best institute to learn c,c++ in ameerpet hyderabad
What is nutshell in programming language?
1 Answers Satyam, Tech Mahindra,
What is namespace?
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!!!)
What is the main purpose of inheritance law?
what is oops
i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????
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
Why we use classes in oop?
how can we design a magic square in c++?or suggest me the basic idea of it.
Precompilation ?