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

Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

1051


Where do I find the current c or c++ standard documents?

1138


Can recursive program be written in C++?

1273


What is the benefit of c++?

1209


Is sorted c++?

1166


Which ide is best for c++?

1094


Can turbo c++ run c program?

1150


Explain what are the sizes and ranges of the basic c++ data types?

1207


What are the stages in the development cycle?

1112


If you want to share several functions or variables in several files maitaining the consistency how would you share it?

1053


Where Malloc(), Calloc(), and realloc() does get memory?

1104


What is a static element?

1138


Define a nested class. Explain how it can be useful.

1139


What is std :: endl?

1081


Explain stack & heap objects?

1100