C++ Programming Question: Download C++ Programming PDF

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

Tweet Share WhatsApp

Answer:

When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the genericity) to the designer of the container or manager class.

Download C++ Programming PDF Read All 120 C++ Programming Questions
Previous QuestionNext Question
Explain the ISA and HASA class relationships. How would you implement each in a class design?What is a mutable member?