What is a template?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What polymorphism means?

791


What is abstract class in oop?

720


Why is destructor used?

743


What is difference between oop and pop?

835


What is methods in oop?

722


Why multiple inheritance is not allowed?

776


What is class and example?

781


What is encapsulation c#?

787


What is ambiguity in inheritance?

816


explain sub-type and sub class? atleast u have differ it into 4 points?

2025


What is overriding in oops?

801


What is difference between class and object with example?

783


What is the problem with multiple inheritance?

793


What is the difference between static polymorphism and dynamic polymorphism?

822


is there any choice in opting subjects like 4 out of 7

1909