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 |
what is c++
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
describe private access specifiers?
What is flush () in c++?
What is c++ mutable?
Mention the purpose of istream class?
What happens if an exception is throws from an object's constructor and from object's destructor?
Implement stack operations with pointers with appropriate exception checks.
How can we check whether the contents of two structure variables are same or not?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
How many bit combinations are there in a byte?
What jobs can you get with a c++ certification?