OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Abstract classes are classes with pure virtual member functions that you must override to provide some behavior.
They serve two main purposes:
For example, the ObjectWindows THSlider and TVSlider classes could each be derived directly from TScrollBar. Although one is vertical and the other horizontal, they have similar functionality and responses. This commonality warrants creating an abstract class called TSlider. THSlider and TVSlider are then derived from TSlider with the addition of a few specialized member functions to draw the sliders differently. You can't create an instance of an abstract class. Its pure virtual member functions must be overridden to make a useful instance. TSlider, for example, doesn't know how to paint itself or respond directly to mouse events. To create your own slider (for example, a circular slider), try deriving your slider from TSlider or try deriving it from THSlider or TVSlider, depending on which best meets your needs. In either case, you add data members and add or override member functions to create the desired functionality. If you want to have diagonal sliders going both northwest-southeast and southwest-northeast, you can create an intermediate abstract class called TAngledSlider.