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 |
print first nodd numbers in descending order
What is malloc in c++?
What is object in c++ wikipedia?
Explain what data encapsulation is in c++?
How can a struct in c++ differs from a struct in c?
Explain what you mean by a pointer.
what is data encapsulation in C++?
What are the various situations where a copy constructor is invoked?
Why do we use string in c++?
What are the characteristics of friend functions?
Does c++ have foreach?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?