Difference between typename and class?

Hey guys, just wondering what the difference is with this:
1
2
3
4
5
6
7
8
9
10
11
template <class T>
class GiveValues 
{
  public:
	T values [2];
    GiveValues (T first, T second)
    {
		values[0]=first; 
		values[1]=second;
    }
};

and
1
2
3
4
5
6
7
8
9
10
11
template <typename T>
class GiveValues 
{
  public:
	T values [2];
    GiveValues (T first, T second)
    {
		values[0]=first; 
		values[1]=second;
    }
};

as they both have the same outcome?
Last edited on
The only difference between both prototypes is the use of either the keyword class or the keyword typename. Its use is indistinct, since both expressions have exactly the same meaning and behave exactly the same way

from http://www.cplusplus.com/doc/tutorial/templates.html


As the name suggests, using typename you have to type for a longer name...
Last edited on
Cheers for that - as you can see the above code is from that tutorial - but I must have skipped that paragraph.

Thanks Bazzy ;)
Topic archived. No new replies allowed.