Using Template Items

You can treat template items as you would any other type. You can pass them as parameters, either by reference or by value, and you can return them as the return values of functions, also by value or by reference. Listing 23.2 demonstrates how to pass Template objects.

Listing 23.2. Demonstrating Parameterized Lists
 0: // *********************************************** 1: // FILE: Listing 23.2 2: // 3: // PURPOSE: Demonstrate parameterized list 4: // NOTES: 5: // 6: // COPYRIGHT: Copyright (C) 1997 Liberty Associates, Inc. 7: // All Rights Reserved 8: // 9: // Demonstrates an object-oriented approach to parameterized 10: // linked lists. The list delegates to the node. 11: // The node is an abstract Object type. Three types ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.