TITLE: Callbacks and multiple inheritance, part I

This example is based upon "Subobject Members", Stephen Dewhurst, 
C++ Report, V5 N3. This is part 1 of a multipart example.

Suppose that you need to model an engine and a button. When the
button is pressed, the engine is supposed to start. One convenient
way to handle this "callback" relationship is to use multiple
inheritance (we do this in Guide, SES/design, and Objectbench).

.................................................................

class ButtonCallback {
  public:
    virtual void callback () = 0;
};

.................................................................

class Button {
    ButtonCallback& target;
  public:
    Button (ButtonCallback& bcb) : target(bcb) {}

    virtual void press ();
};

void Button :: press ()
{
    target.callback ();
}

.................................................................

class Engine : public ButtonCallback {
    // ...
  public:
    void start ();
    virtual void callback ();
};


void Engine :: callback ()
{
    start ();
}

