When is a template better solution than a base class??

Answers were Sorted based on User's Feedback



When is a template better solution than a base class??..

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

When is a template better solution than a base class??..

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

Post New Answer

More C++ General Interview Questions

print first nodd numbers in descending order

7 Answers  


What is malloc in c++?

0 Answers  


What is object in c++ wikipedia?

0 Answers  


Explain what data encapsulation is in c++?

0 Answers  


How can a struct in c++ differs from a struct in c?

0 Answers  






Explain what you mean by a pointer.

0 Answers   TCS,


what is data encapsulation in C++?

0 Answers  


What are the various situations where a copy constructor is invoked?

0 Answers  


Why do we use string in c++?

0 Answers  


What are the characteristics of friend functions?

0 Answers  


Does c++ have foreach?

0 Answers  


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

0 Answers  


Categories