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 does stl mean in slang?
what is template and type convertion
What is a list in c++ stl?
Is string part of stl?
How does an stl file work?
What is stl language?
When did c++ add stl?
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.
If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....
Explain stl.
Is stl open source?
How stl is different from the c++ standard library?
What is the stl, standard template library?
What is a standard template library (stl)? What are the various types of stl containers?
How do I convert a stl file?