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
How the virtual functions maintain the call up?
Difference between overloading vs. Overriding
How is new() different from malloc()?
What are structures and unions?
Why was c++ made?
What is a binary file? List the merits and demerits of the binary file usagein C++.
What is the benefit of encapsulation?
What are the two shift operators and what are their functions?
What is #include cmath?
What is a v-table?
Why iomanip is used in c++?
how to access grid view row?
Which programming language is best to learn first?
What is object file? How can you access object file?
What is double in c++?