Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

given unsigned int ui1=3,ui2=7; what are the outputs of a)ui1 & ui2 b)ui1 && ui2 c)ui1 | ui2 d)ui1 || ui2 i also need the justification for the answers thank you

2 Answers  


What are inline functions? What is the syntax for defining an inline function?

0 Answers  


const char * char * const What is the differnce between the above two?

11 Answers   TCS,


What are iterators in c++?

0 Answers  


If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2.

1 Answers  






What is wrapper class in c++?

0 Answers  


write a programming using for loop in c++ to generate diamond trangel?

1 Answers   NIIT,


Define token in c++.

0 Answers  


How can a called function determine the number of arguments that have been passed to it?

0 Answers  


What will happen if when say delete this ?

7 Answers  


Is c++ an integer?

0 Answers  


How many storage classes are available in C++?

1 Answers  






Categories