Hi,

I looked for this information, but couldn't find it anywhere. Is there a difference between a "template class" and a "class template" or are they just two different ways of saying the same thing ?

Thanks a lot.

Class Template is the code for generating template classs.

i.e.

template<typename T> foo { } // class template

foo<int> t; // template class

commented: Wasn't worth waiting two YEARS for :( -4

Template class:
A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.

Class template:
A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.

class template is a template that defines a class

template <typename T> class SomeClass {...}; // this is a class template
template <typename T> int some_function(T&) {...} // this is a function template
A template class is a particular kind of class. There are many kinds of classes, and in particular, template classes are those defined using a class template. Contrast:

SomeClass sc; // SomeClass is an ordinary (non-template) class
SomeClass<int> sc; // SomeClass<int> is a template class

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.