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

What flag means?

601


Difference between pointer to constant vs. Pointer constant

699


Will a catch statement catch a derived exception if it is looking for the base class?

635


Which software is used for c++ programming?

713


Explain all the C++ concepts using examples.

787






What is abstraction with real time example?

729


Explain the problem with overriding functions

681


What is a null object in c++?

738


What is the use of default constructor?

660


What are c++ templates used for?

713


Which programming language is best?

647


Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers

699


What is const pointer and const reference?

702


What are special characters c++?

655


What is difference between malloc()/free() and new/delete?

733