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

without if else statement can be written ah

0 Answers  


1.Between 100 and 999 are some numbers that have the characteristics that if you cube the individual digits and sum together you will get the same number. 2. A program that can accept as input an integer and output the equivalent of that number in words.

3 Answers  


Can we change the basic meaning of an operator in c++?

0 Answers  


What are the advantages of c++ over c?

0 Answers  


What are the benefits of c++?

0 Answers  






i want the NIC programmer-B model papaer pattren, iwant the all model papers?

15 Answers   NIC,


Explain Memory Allocation in C/C++ ?

0 Answers   Infosys,


What are the advantages of early binding?

0 Answers  


What do you mean by translation unit?

0 Answers  


What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero

0 Answers  


What is void pointer in c++ with example?

0 Answers  


What is set in c++?

0 Answers  


Categories