what is the usage of clas templates

Answers were Sorted based on User's Feedback



what is the usage of clas templates..

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

what is the usage of clas templates..

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

what is the usage of clas templates..

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

what is the usage of clas templates..

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

what is the usage of clas templates..

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

Post New Answer

More OOPS Interview Questions

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.

4 Answers   NIIT, TCS,


What exactly is polymorphism?

0 Answers  


Where You Can Use Interface in your Project

0 Answers   KPIT,


Write a program to demonstrate the use of 'Composition' in C++

2 Answers  


In which Scenario you will go for Interface or Abstract Class?

1 Answers   InfoAxon Technologies,






What is encapsulation with real life example?

0 Answers  


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.

0 Answers  


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 :( :-?

2 Answers   Infosys, Microsoft,


what type of questions

0 Answers   IBM,


function overridind means and simple program

2 Answers  


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?.

2 Answers  


what is virtual function in c++

6 Answers  


Categories