Listing 3: Template class TSubscriberHookup

template<class Subscriber>
class TSubscriberHookup :
    public SubscriberHookup
{
public:
  //prototype
  typedef void
  (Subscriber::*DeliveryMethod)();   

protected: // handle to the object
           // that has the subscription
  Subscriber* _subscriber;
           // the subscriber's method
           // to deliver messages to
  DeliveryMethod _method;

  // call the bound method in the
  // subscribing object
  void deliver() {
    (_subscriber->*_method)();
  }

public:
  TSubscriberHookup
    (const char* subscription,
     Subscriber* subscriber,
      DeliveryMethod method)
    : SubscriberHookup(subscription) {
    _subscriber = subscriber;
    _method = method;
  }
};
/* End of File */