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 is the difference between mutex and binary semaphore?
What are the rules for naming an identifier?
What is static function? Explain with an example
Differences between private, protected and public and give examples.
What is the difference between interpreters and compilers?
Difference between Overloading and Overriding?
35 Answers Appnetix Techno, GameLoft, HP, IBM, NIIT, Rohde and Schwarz,
What are different types of polymorphism supported by C++
Write a single instruction that will find the remainder of integral division when x is divided by y. Have the answer stored in z.
Is sorted c++?
What is friend class in c++ with example?
What is a tree in c++?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;