O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.2. Template Class Definition

Here's the format for template class definitions.

template <class TYPE1, class TYPE2, Type name1, Type nameN> 
class Class_name { . . . };

A template parameter list appears in front of a class definition and consists of the keyword template followed by a comma-separated list of class-type pairs and/or constant expression parameters enclosed by < and >. The class-type pairs (class TYPE1,class TYPE2) follow the same rules as template functions (page 389), but constant expression parameters (Type name1, Type nameN) have a different syntax. With template parameter lists, you may combine class-type pairs and constant expression parameters in any order (or omit them). For now, let's work with the class-type syntax, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required