Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help on template function in C++

    Hi everyone!

    Yesterday I was reading my C++ book. There I just came across with the function "template". I got the basic idea as to where to use it but got a bit confused with the syntax which was given over there. Can any one help on this. The syntax was somewhat like this:

    Code:
    template <class T1,class T2,class T3,........>
    ReturnType FunctionName (argument1, argument2,.......,argumentN)
    {
    //Body of the function
    }
    Please explain me this.

    Thanks in advance

  • #2
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • Users who have thanked eak for this post:

    Codman (06-24-2008)

  • #3
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This also informative content also help you
    http://www.codersource.net/cpp_template_function.html

  • #4
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks eak for the info given by you. It was really helpful to me.

    Thanks a lot.

  • #5
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    I haven't done CPP since college but it really helped me with my programing in general. I especially liked the data structures class I took.

    I sometimes miss the templated classes/functions and class member function overloading that you can do in CPP.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •