When is a template better solution than a base class??
Answers were Sorted based on User's Feedback
Answer / mayank kumar
as template is in form of generic class and generic
function so here the class and function works for all. also
in template we can change the data type of function
parameter as well as of the data member present in class.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / faruk
1.when you are designing a generic class to contain or otherwise manage objects of other types.
2.when the format and behaviour of those other types are unimportant to their containment or management.
3.particularly when those other types are unknown.
Is This Answer Correct ? | 3 Yes | 1 No |
What do you mean by abstraction. Explain your answer?
Explain the concept of dynamic allocation of memory?
Is python better than c++?
What are stacks?
How to stop conversions among objects?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
simple c++ program for "abcde123ba" convert "ab321edcba" with out using string
Write a C++ program which will compute the volume of a sphere or a cylinder after prompting the user to type the first character for the shape name.
0 Answers An-Najah National University,
What is cout flush?
Write a c++ code that will calculate the roots of a quadratic equation a2+ bx+c=0 Hint: d = sqrt (b2-4ac), and the roots are: x1 = (€“b + d)/2a and x2 = (€“b €“ d)/2a (use sqrt function from cmath.h )?
What is the difference between the parameter to a template and the parameter to a function?
What is a node class in c++?