If the new function needs services performed by other classes, create an interface class to represent the relationship. Add complementary functions when they might be useful. This takes more time but may save it for others in the future. If you are going to make a large number of changes, consider writing a whole new class. Extending the Class Structure Typically when creating a program it will prove necessary to extend the class structure in some way.
Common extensions are the creation of a new dataset type or method to manipulate existing data.
It may also often be necessary to create an interface object that conforms to an existing interface, but which is implemented in a different way. The basic formulations for extending the class structure are described below. Make simple extensions by inheriting from a class and adding some functions. Create new methods and datasets by inheriting from the appropriate abstract class, implementing the virutal functions, and adding member functions to handle the new functionality.