Answer Posted / achal
In C++ there are 2 kinds of templates. i) function
templates ii) Class templates.
Among these class templates are more common.
e.g.
template <class T > class Sample
{
public:
T m1;
void fun(T);
};
Now here we have created a class which has a data member of
type T. Now this T can be int, unsigned int, char etc.
Thus templates are said to be used for generic programming.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
Where do I find the current c or c++ standard documents?
Can recursive program be written in C++?
What is the benefit of c++?
Is sorted c++?
Which ide is best for c++?
Can turbo c++ run c program?
Explain what are the sizes and ranges of the basic c++ data types?
What are the stages in the development cycle?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
Where Malloc(), Calloc(), and realloc() does get memory?
What is a static element?
Define a nested class. Explain how it can be useful.
What is std :: endl?
Explain stack & heap objects?