How to Write ADTs
In order to to define a class so that it will be an abstract data type, you need to separate the specification of how the type is used by the programmer from the details of how the type is implemented
The separation should be so complete that you can change the implementation of the class, and any program that uses the class ADT should not need and additional changes
One way to ensure this separation is to:
- make all member variables private members of the class
- make each of the basic operations that the programmer needs a public member function of the class and fully specify how to use each such public member function
- make any helping functions private member functions