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
How do you convert stl to steps?
Is stl open source?
Name the different types of stl containers.
What is the use of stl?
write a program that will accept a number and print.its equivalent in words the maximum input number is 9999
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
Who created stl?
draw a flowchart that accepts two numbers and checks if the first is divisible by the second.
Define stl.
write a program to convert a decimal number in to its equivalent binary number?
What is a standard template library (stl)? What are the various types of stl containers?
What is a standard template library (stl)?
What are stl algorithms?
Is there any error below, its a code to delete all entires from a map #include
how can u do connectivity in c++ language? plz send me connectivity code in c++ ?