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 |
Explain how we implement exception handling in c++?
Can I make ios apps with c++?
What is a hash function c++?
Explain what happens when a pointer is deleted twice?
What is the handle class?
class base { public: int fun(int) {} }; class base2 { public: int fun(float) { } }; so here qustion is both function either function overloading or over riding;
Why is c++ still popular?
Will rust take over c++?
what is the order of initialization for data?
10 Answers Amazon, TCS, Wipro,
What is a constant? Explain with an example.
What is a mutex and a critical section.Whats difference between them?How do each of them work?
Describe friend function & its advantages.