In what cases using of a 'template' is a better approach
then using of a 'base class'?
Answer Posted / atul jawale
Template is a better approach than using of a base class if:
1. Multiple copies of code for different data types with
the same logic.
2. If a set of functions or classes have the same
functionality for different data types
Then, a class becomes good candidates for being written as
Templates.
One good area where this C++ Class Templates are suited
can be container classes. Very famous examples for these
container classes will be the STL classes like vector, list
etc., Once code is written as a C++ class template, it can
support all data types.
Though very useful, It is advisable to write a class as a
template after getting a good hands-on experience on the
logic.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase
What is a standard template library (stl)?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
Is string part of stl?
In what scenario does the Logical file and Physical file being used?
Explain stl.
What is the use of stl?
please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html
Is there any error below, its a code to delete all entires from a map #include
What is a stl vector?
How stl is different from the c++ standard library?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is meant by stl in c++?