A SERVICE OF

logo

Abstract classes, which are classes with pure virtual member functions that
Abstract classes
you must override to provide some behavior serve two main purposes.,
They provide a conceptual framework to build other classes on and, on a
practical level, they reduce coding effort.
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.
Y u can’t create an instance of an abstract class. Its pure virtual membero
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.
If you wanted to create your own slider (for example, a circular slider), you
might try deriving your slider from TSlider or it might be easier to derive
from THSlider or TVSlider, depending on which best meets your needs. In
any case, you add data members and add or override member functions to
add the desired functionality If you wanted to have diagonal sliders going.
both northwest-southeast and southwest-northeast, you might want to
create an intermediate abstract class called T ngledSlider.A
The following figure shows the inheritance of TInputDialog. As you can see,
Inheriting
TInputDialog is derived from TDialog, which is derived from TWindow,
members
which is in turn derived from TEventHandler and TStreamable. Inheritance
lets you add more specialized behavior as you move further along the
hierarchy.
Figure 1.1
TDialog inheritance
The following table shows the public data members of each class, including
those inherited from the TDialog and TWindow base classes:
Chapter 1, ObjectWindows overview
19