Thread: what are the differences between typename and class

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    216

    what are the differences between typename and class

    The following code work exactly the same no matter I use the keyword typename or class.
    Code:
    template < typename my_type >
    my_type fun( my_type arg1, my_type arg2 )
    {
    	return arg1 + arg2;
    }
    What are the differences between these keywords when used to define generic functions?
    Last edited by Antigloss; 09-02-2005 at 08:12 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Partners (D&D fan preferably)
    By C_ntua in forum Game Programming
    Replies: 44
    Last Post: 11-22-2008, 09:21 AM
  2. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 04:30 AM
  3. typedef and typename
    By VirtualAce in forum C++ Programming
    Replies: 16
    Last Post: 07-17-2008, 08:11 PM
  4. Default class template problem
    By Elysia in forum C++ Programming
    Replies: 5
    Last Post: 07-11-2008, 08:44 AM
  5. typename in class template
    By l2u in forum C++ Programming
    Replies: 4
    Last Post: 04-02-2008, 04:22 PM