The Implementation File

Place your definitions in an implementation file. The implementation file has the same root or base name as the header file, but a different extension. You'll use .cpp in this class but other conventions include .cxx, .cc, and .C (a capital 'c').

  1. Create an implementation file using the extension .cpp.
  2. Add a file comment to the top of the file.
  3. #include the interface file for the library you are implementing.
  4. If you use other libraries, such as string, you should include them as well. This example does not.
  5. Add a using directive if you are using any library types. This library does not.
  6. Copy the prototypes from each of the functions in the header file into the implementation file. You don't need to bring across the documentation. Make sure, also, that you don't copy the header guards.
  7. Stub out each of the functions.

This is purely mechanical. You want to practice it until it becomes second nature. You should memorize this part, so you don't have to expend any brain cells to complete it.