When is a template better solution than a base class??
Answers were Sorted based on User's Feedback
Answer / mayank kumar
as template is in form of generic class and generic
function so here the class and function works for all. also
in template we can change the data type of function
parameter as well as of the data member present in class.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / 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 |
What is an Iterator class?
Why do we need constructors in c++?
How do you clear a map in c++?
What is new in c++?
What is c++ hash?
What are c++ variables?
What is a forward referencing and when should it be used?
What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack
What are the rules for naming an identifier?
What flag means?
Write a program and call it sortcheck.cpp which receives 10 numbers from input and checks whether these numbers are in ascending order or not. You are not allowed to use arrays. You should not define more than three variables
what is the order of initialization for data?
10 Answers Amazon, TCS, Wipro,