Skip to Content
Navigating C++ and Object-Oriented Design
book

Navigating C++ and Object-Oriented Design

by Paul Anderson, Gail Anderson
October 1997
Intermediate to advanced
800 pages
20h 48m
English
Pearson
Content preview from Navigating C++ and Object-Oriented Design

10.15. Exercises

1: Provide another Stack constructor that builds Stack objects and initializes them with generic data (see Listing 10.1 on page 415). Test your solution with different data types.
2:Redesign the template Stack class (page 415) to contain class Array. Do you need the full boilerplate?
3:Implement a resize() member function for class Array. Devise a strategy to implement resize() for Array2d. Can you reuse resize() from your Array class?
4:Explain why the template Block class from Listing 10.15 on page 441 is a better design approach than a template function that allocates memory for generic arrays and initializes each element. Consider the following examples with template function new_data().
 int ival = 0; String sval = "abc"; int ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Exploring C++20: The Programmer's Introduction to C++

Exploring C++20: The Programmer's Introduction to C++

Ray Lischner

Publisher Resources

ISBN: 0135327482Purchase book