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
Is there any error below, its a code to delete all entires from a map #include
How do I convert a stl file?
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
What is a stl vector?
Explain stl.
write a program to convert a decimal number in to its equivalent binary number?
What is stl stack?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
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
Why should a c++ programmer be interested in stl?
how can u do connectivity in c++ language? plz send me connectivity code in c++ ?
What are the different types of stl containers?
What is stl stand for?
What are the various types of stl containers?
What does stl stand for in basketball?