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

What is an operator function? Describe the function of an operator function?

621


What are virtual constructors/destructors?

580


Name the implicit member functions of a class.

602


What are single and multiple inheritances in c++?

581


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

576






How does atoi function work?

628


Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list

618


What is the v-ptr?

645


What is type of 'this' pointer? Explain when it is get created?

591


What are the advantages of using typedef in a program?

646


Can you pass an array to a function in c++?

547


What is the difference between map and hashmap in c++?

563


What is helper in c++?

577


You want to link a c++ program to c functions. How would you do it?

543


Do you need a main function in c++?

561