Skill Building Exercises

 < Day Day Up > 



  1. Research: Explore your compiler! Study your compiler's documentation and determine how it implements template functionality. Enter and compile the function and class template examples given in this chapter. Do they behave the same or are there behavioral differences? Are there any surprises?

  2. Function Template: Write a function template named max that takes two object references as arguments and returns a reference to the larger of the two objects.

  3. Function Template: Write a function template named compare that takes three arguments. The first two arguments will be object references. The third argument will be a comparator function. (For a hint on how to approach this exercise see the section on function pointers in chapter 9)

  4. Class Template: Write a class template that implements a doubly-linked list that can store any type value.

  5. Research: Procure one of the standard template library references listed at the end of this chapter and read it.

  6. STL: Explore the standard template library. Write a short program that tests all the container components.

  7. Research: List the STL container components. Write a brief description of each one and explain in what programming scenarios each would come in handy.

  8. Research: Do some more research on iterators. How many different types of iterators are there and how is each used?

  9. Research: List each of the STL algorithms. Write a brief description of each one and on what types of components they can be used.

  10. Pop Quiz: What company was initially responsible for the development of the C++ standard template library?



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net