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 |
write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1
structure that describe a hotel with name, address,rooms and number of rooms
What is increment operator in c++?
what is data encapsulation in C++?
What is the purpose of ios::basefield in the following statement?
What is a manipulator in c++?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
Explain some examples of operator overloading?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
Why is standard template library used?
What is enum class in c++?
Show the declaration for a static member variable.