[2087] in java-interest
Re: Fn ptrs & ... callbacks!?
daemon@ATHENA.MIT.EDU (Mike Christiansen)
Sat Sep 23 22:58:14 1995
To: java-interest@java.sun.com
From: mikec@metronet.com (Mike Christiansen)
Date: Sat, 23 Sep 1995 19:24:37 LOCAL
In article Andrew Wason <aw@bae.bellcore.com> writes:
>Sal Cataudella <salc@ovid.com> writes:
>>
>> Let's say you need to create 2 sliders, and have each one of them invoke
>> a different method. With the method ptr callback technique, you can create
>> 2 instances of sliders and simply register the method and object pointers
>> you wish to have invoked. Thus , you are reusing code (the slider's)
>> by instantion, not by subclassing. Without the method callback technique,
>> you are *forced* to subclass *twice*, in order to reuse code.
>You could define a new interface, Callbackable that defines a
>callback method. Then create a single slider subclass that
>manages a Vector of Callbackable instances. In the sliders
>callback method, call the callbackable method of each
>Callbackable in the Vector.
If I'm not mistaken, the Observer / Observable classes provide a basic
dependence mechanism which can used to implement this.
mike
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Christiansen
mikec@metronet.com
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com