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
What is the purpose of the "delete" operator?
What is abstraction in c++ with example?
Which is best ide for c++?
List the issue that the auto_ptr object handles?
What is ctime c++?
What are the advantages of using pointers in a program?
What is polymorphism and its type in c++?
How can I learn dev c++ programming?
Explain how a pointer to function can be declared in C++?
What is difference between c++ and c ++ 14?
Difference between a homogeneous and a heterogeneous container
What are the manipulators in c++?
Name four predefined macros.
Explain polymorphism?
What are friend classes? What are advantages of using friend classes?