Lecture 2

Learning objectives

After this class (which reviews C++ material that you should already know!), you should be able to:

  1. Describe the concept of an abstract data type, and how C++ classes help implement them.
  2. Mention two benefits of data hiding.
  3. Mention which type of file typically contains the interface, and which the implementation, in C++.
  4. Explain why templates are normally defined in .h files.
  5. Define and use template functions and classes.
  6. Give examples of some common errors with the use of pointers.
  7. Given code with incorrect use of pointers, identify the problems and correct them.
  8. Explain when "deep copy" is needed, why it is needed, and what are the typical features that need to be implemented to ensure deep copy.
  9. Explain why self-assignment can lead to incorrect code, when we overload assignment to ensure deep copy.
  10. Explain how a friend function is different from others.

Reading assignment

  1. Chapter 1, up to sec 1.6 (except sec 1.3 and 1.5).
  2. Optional: Fall 2003 lecture notes has additional explanations for templates (chapter 5), and on deep copy (chapter 2).

Exercises and review questions


Last modified: 30 Aug 2004