There are three kinds of files associated with the implementation of an abstract data type:
structdefinitions that are required for the ADT.
adt.c; otherwise, there are multiple files whose names are
adt-something.c. This file contains the implementation of the functions declared in the public header.
In the case of the
int_stack example, the three files will be called
What we are doing is, by convention, setting up the following contract between the (writer of the) ADT and the rest of the program(mers): as long as the rest of the program agrees to manipulate the ADT solely by using the functions in the public header, the ADT will guarantee that its behavior will not change.
This means, in particular, that the ADT writer is allowed to change the implementation of the ADT in any manner they feel, as long as the behavior of the public functions does not change.
Note that it is perfectly acceptable for the public header to
#include the private header.
It may be necessary for some piece of code to use a function that is not guaranteed. Such a function will need to be in the private header, and every time there is a change, special action will have to be taken.