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's the "software peter principleā?
What is the difference between set and map in c++?
What is the difference between a reference and a pointer?
What are the two types of comments, and how do they differ?
Explain how to initialize a const data member.
Write about a nested class and mention its use?
In c++, what is the difference between method overloading and method overriding?
In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that
Difference between declaration and definition of a variable.
How many keywords are used in c++?
What is a hashmap c++?
Which function cannot be overloaded c++?
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
What is null c++?
Explain the uses oof nested class?