O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, fifth edition by Rogers Cadenhead, Jesse Liberty

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

Hour 23. Creating Templates

What Are Templates?

In Hour 19, “Storing Information in Linked Lists,” you learned how to make a linked list. Your linked list was encapsulated: The list knew only about its head pointer; the head pointer delegated its work to internal pointers, and so forth.

One problem with the linked list was that it only knew how to handle the particular data types it was created to work with. If you wanted to put anything else into your linked list, you couldn’t do it. You couldn’t, for example, make a linked list of Car objects, or of Cat objects, or any other object ...

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