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').
- Create an implementation file using the extension
.cpp.
- Add a file comment to the top of the file.
- #include the interface file for the library you are implementing.
- If you use other libraries, such as string, you should include them as
well. This example does not.
- Add a using directive if you are using any library
types. This library does not.
- 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.
- 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.