Stephen Leake wrote:
>Corey Minyard <[log in to unmask]> writes:
>
>
>
>>Every publish-subscribe interface I have ever seen in OO languages used
>>polymorphism. Function pointers are used in languages that don't
>>directly support polymorphism.
>>
>>
>
>How do you get multiple subscribers to the same event with polymorphism?
>
>
>
Every subscriber supplies a reference to a data structure that extends a
specific class. Each subscriber extends the interface to create their
own class and registers that class with the eventing mechanism. The
subsclass overrides a specific function or functions that the event
calls as the "callbacks", and they can carry data for the subscriber to use.
I have a telephony-type event framework in my adasl package, if you need
an example. I'm not sure it's in the release version, if not I will cut
a new release if someone want to see it.
-Corey