Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



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

Answer / neelkamal yadav

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.

Prior to templates, you had to use inheritance; your design might include a generic List container class and an application-specific Employee class. To put employees in a list, a ListedEmployee class is multiply derived (contrived) from the Employee and List classes. These solutions were unwieldy and error-prone. Templates solved that problem.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Write a program in C++ for Fibonacci series

0 Answers   Axtria, ITC Indian Tobacco Company,


Can c++ do everything c can?

0 Answers  


Difference between overloaded functions and overridden functions

0 Answers  


Can you use the function fprintf() to display the output on the screen?

0 Answers  


What is object file? How can you access object file?

0 Answers  


why is iostream::eof inside a loop condition considered wrong?

0 Answers  


What does the nocreate and noreplace flag ensure when they are used for opening a file?

0 Answers  


What are friend functions?

1 Answers  


What is & in c++ function?

0 Answers  


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

0 Answers  


How much do c++ programmers make?

0 Answers  


How does work in c++?

0 Answers  


Categories