In what cases using of a 'template' is a better approach
then using of a 'base class'?
Answer Posted / nishikant sahu
You can judge the need of Template and base class based on
following rule of thumb..
When operation(Method) doesn't affect on changing the data
type, use template.for ex when you want to write the stack
class of different data TYPE(int, bool,flaot) PUSH & POP
method doesn't affect on changing the data TYPE so in this
case you have to use TEMPLATE instead of Inheritance.
When operation(Method) does affect on changing the data
type, use Inheritance(base class).
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is stl in c++ with example?
How is stl different from c++ standard library?
What two types of containers does the stl provide?
a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister
What is a standard template library (stl)? What are the various types of stl containers?
sir please send me bpcl previous question papers
i wanted to know about questions about c,c++ , which is required for placements.... im a fresher
Can we use stl in coding interviews?
Who wrote stl?
Is stl part of c++ standard?
How do you convert stl to steps?
How does an stl file work?
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.