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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you add an element to a set in c++?

541


What is the benefit of learning c++?

541


Is it possible to have a recursive inline function in c++?

538


What is the two main roles of operating system?

506


What is srand c++?

566






What is split a string in c++?

684


Write a program using display() function which takes two arguments.

599


Is c++ a low level language?

506


Define macro.

571


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

818


Where must the declaration of a friend function appear?

528


Define the process of handling in case of destructor failure?

564


What is c++ flowchart?

668


Write about a nested class and mention its use?

614


Which is best c++ or java?

604