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 is the use of default constructor?

1041


why is iostream::eof inside a loop condition considered wrong?

1008


Why do we use using namespace std in c++?

1027


What is the best c++ ide?

1083


Is swift better than c++?

891


What are arrays c++?

1048


What is ios flag in c++?

1125


What is the purpose of the "delete" operator?

1009


Differentiate between a constructor and a destructor in c++.

969


Describe about storage allocation and scope of global, extern, static, local and register variables?

1201


In a function declaration, what does extern mean?

996


What are the benefits of c++?

981


How do you find out if a linked-list has an end?

1066


Why are arrays usually processed with for loop?

1187


What is std namespace in c++?

1117