what r the application of templat function and templat class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mush1578
    New Member
    • Feb 2010
    • 15

    what r the application of templat function and templat class

    how we wright the templet class and function
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You write template classes and functions to capture what is done regardless of the type of the data.

    In C if you need a function to copy an array of char, you will need another function to copy and array of int, another to copy an

    array of float, etc...

    In C++ you write one template function to copy an array of an array of any type.

    The compiler makes a copy of the template, puts in the correct type and uses this copy in your program. Basically, the compiler

    generates all of the functions you would have to write in C.

    Comment

    • Jajjo
      New Member
      • May 2009
      • 26

      #3
      Try this:

      For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.


      That should be helpful. If you can't find out how to write a template class with that, then you need more help than with just your code...

      Comment

      Working...