Why are you able to declare them using the class keyword or typename keyword? Is there absolutley no difference? Thanks
clutchkiller
3
Junior Poster
Recommended Answers
Jump to PostNo. there is no diference whatsoever. i think that class was used originally when templates were added to C++ to avoid adding a new keyword, however eventually a new keyword was added anyway.
Jump to PostOK. I shall provide more information. In the context to which you refer where templates are defined e.g.
template<typename T>
void func(T& t ){}or
template<class T>
void func(T& t ){}There is no difference whatsoever, the keywords are totally interchangeable here.
An excerpt …
All 6 Replies
mattjbond
54
Junior Poster
clutchkiller
3
Junior Poster
tkud
0
Posting Whiz in Training
mattjbond
54
Junior Poster
clutchkiller
3
Junior Poster
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.