[Chicago-talk] error reporting in overridden method

Steven Lembark lembark at wrkhors.com
Tue Sep 21 15:28:07 CDT 2004



-- "Randal L. Schwartz" <merlyn at stonehenge.com>

>>>>>> "Jim" == Jim Thomason <thomasoniii at gmail.com> writes:
>
> Jim> Anyway, I subclassed it and overrode the method,
>
> This is the source of your problems.  If you aren't doing
> everything the parent did, you're not properly subclassing.
>
> If you can't call SUPER, you should refactor the parent method so that
> it provides parts you *can* call, and skip the parts you *can't* call.
>
> So, instead of
>
>   Parent->validate
>
> being standalone, we get
>
>   Parent->validate
>
> that calls
>
>   Parent->validate1, Parent->validate2, Parent->validate3
>
> and then in the kid, we override as

That or have them each deal with their own portion
of it and use NEXT to pass the validation along to
base classes.

Note: shortcomming to SUPER for this is that it croaks
if the parent class doesn't provide a method. NEXT will
search through more derived classes to locate the
method.


-- 
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list