what is the usage of clas templates
Answers were Sorted based on User's Feedback
Answer / saurabh chauhan
templates are used to create generic functions as well as
classes..which can support miltiple data types..
they are mainly used when algorithm is commom for diff data
types...so we dont hav to implement again and again for
diff data types ..we make a generic func. which works for
all...
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / anil kumawat
through this we can make generic function. so this function
will work for any data type.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / anil bisht
A template is a C++ feature that allows functions and
classes to be defined with any type.Class template is a
template used to generate template classes. You cannot
declare an object of a class template.Template class is an
instance of a class template.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / james prasanna.j
We can able to operate "class template" functionalities in
generic way, which supports different data types.
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / keshav.gadde
Template is a mechanism that allows one function or class to
deal with diffrent data types.
Using templates we can design a template class that operates on
diffrent data types.
Is This Answer Correct ? | 0 Yes | 1 No |
How can i write a code in c# to take a number from the user and then find all the prime numbers till the number entered by the user.
What exactly is polymorphism?
Where You Can Use Interface in your Project
Write a program to demonstrate the use of 'Composition' in C++
In which Scenario you will go for Interface or Abstract Class?
1 Answers InfoAxon Technologies,
What is encapsulation with real life example?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
where is memory for struct allocated? where is memory for class-object allocated? I replied for struct in stack and for class-object in heap. THen he asked if class has struct member variable what happens.class on heap and what about struct in that class? couldnt ans :( :-?
what type of questions
function overridind means and simple program
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
what is virtual function in c++