Previous Slide Point class Module Next Slide

When we separate a set of code into its own files, we call it a module. Although modules can contain sets of functions or sets of classes, we often use a single module for each class.

To create a C++ module for our Point class, we need to create 2 new source code files:

Point.h
This is the header file (or interface) for the module. Those who want to use the class (i.e., in a main program or another module) will have to #include this header file. It contains the class definition.
Point.cpp
This is the implementation file for the module. Those who use the Point class must link their code with this code. It contains all the internals of the class, such as the method definitions.


BU CAS CS - Modules, Separate Compilation, Using Make Files
Copyright © 1993-2000 by Robert I. Pitts <rip@bu.edu> All Rights Reserved.