Help with Templates C++

What is a template, why are they use, and what is it used for?

Page 1 of 1

1 Replies - 511 Views - Last Post: 06 October 2008 - 11:45 AM Rate Topic: -----

#1 UofMCreed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 04-October 08

Help with Templates C++

Posted 06 October 2008 - 11:21 AM

Can anyone help explain to me what a template is, why they are used, and what are they used for? I am having trouble with it, I have a cruddy professor and need some simple explanations and maybe an example or two. PLZ HELP ME!!!


Thnx,
UofMCreed
Is This A Good Question/Topic? 0
  • +

Replies To: Help with Templates C++

#2 GWatt  Icon User is offline

  • member icon

Reputation: 278
  • View blog
  • Posts: 3,078
  • Joined: 01-December 05

Re: Help with Templates C++

Posted 06 October 2008 - 11:45 AM

http://www.cplusplus.../templates.html

Quick version is that templates allow functions to handle many different data types safely.

If you're a C programmer, it's sort of like using the void*, but safer, and won't generate warnings.

If you know Java templates are C++ generics.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1