Extending Functionality

Another reason to create a class would be to create something that simply does not exist. A good example of this would be a class that combines controls to create a new type of control. For example, we could create a text box and a timer control to create a stop watch. Either object, working on its own, cannot provide the full functionality a stop watch would require. If we put them together, we come up with a new control called a Stop Watch that would track the time and display it for use. We'll see an example of a stop watch object in our discussion of how to model an entity, define responsibilities, and finally code the class.