Introduction to Programming and C++

Contents Previous Topic Next Topic

The declaration of the members of a class includes the declaration of the class together with a list of all class members and member functions. A class declaration terminates with a semi-colon.

class ClassName {
	// ...
};

Templates

If a class has a template modifier, it appears before the class:

template <typename T>
class ClassName {
	// ...
};

All references to the class after this point must either explicitly include the template or must have a type substituted for the templated variable. For example, the following is a function declaration using the templated class name:

template <typename T>
void f( ClassName<T> );

Contents Previous Topic Top Next Topic