Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the use of templates?

Answer Posted / achal

In C++ there are 2 kinds of templates. i) function
templates ii) Class templates.
Among these class templates are more common.
e.g.
template <class T > class Sample
{
public:
T m1;
void fun(T);
};
Now here we have created a class which has a data member of
type T. Now this T can be int, unsigned int, char etc.
Thus templates are said to be used for generic programming.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the "software peter principleā€?

1152


What is the difference between set and map in c++?

1136


What is the difference between a reference and a pointer?

1123


What are the two types of comments, and how do they differ?

1139


Explain how to initialize a const data member.

1139


Write about a nested class and mention its use?

1105


In c++, what is the difference between method overloading and method overriding?

1148


In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that

1098


Difference between declaration and definition of a variable.

1170


How many keywords are used in c++?

1021


What is a hashmap c++?

1128


Which function cannot be overloaded c++?

1118


Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

3882


What is null c++?

1144


Explain the uses oof nested class?

1144