what is the use of templates?

Answer Posted / aboelella

Template is used to optimize code
instead of implementing the same code for multiple data
types, template works as a way to declare classes and
functions and then to be implemented with different data types

It is dependent on the data structure used to substitute the
template

Is This Answer Correct ?    18 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is c++ used in the real world?

769


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

1014


What do you mean by a template?

810


What are namespaces in c++?

788


What is time_t c++?

792


What is a loop? What are different types of loops in c++?

814


How does a C++ structure differ from a C++ class?

831


Is there finally in c++?

807


Will this c++ program execute or not?

784


Describe Trees using C++ with an example.

819


Are there interfaces in c++?

740


Can we use struct in c++?

766


What is friend class in c++ with example?

670


What is enum class in c++?

915


What do you mean by delegate? Can a user retain delegates?

704