Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding class heirachy
Message
From
25/02/1998 21:51:20
 
 
To
25/02/1998 18:22:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00080957
Message ID:
00081264
Views:
34
>Wel, if I understood correctly the problem, you don't need to get the class hierarchy, but use instead the OO inheritance. You only need to use a DODEFAULT() in the right place:
>
>
**txtBase.CustomError
>do case
>   case error() = 1
>        < do whatever >
>        return 'Return'
>   case error() = 2
>        < do whatever >
>        return 'Retry'
>   otherwise
>        return ''
>endcase
>
>txtSubClass.CustomError
>do case
>   case error() = 3
>        < do whatever >
>        return 'Return'
>   otherwise
>        *-- Call here the ancestor's CustomError method.
>        *-- In this case: txtBase.CustomError
>        *-- This is done by dodefault()
>        return dodefault()
>endcase
>
>Is this what you're looking for?
>
>Vlad

This is my second choice if I can't get the other way to work. The problem I have with this method: if I forget to put in the dodefault() in a method, I may never notice that I'm overlooking the ancestor's CustomError method.
Example:
If I put the above code in txtBase.CustomError and thoroughly debug it, then forget to put the dodefault() in txtSubClass.CustomError, I wouldn't notice that error()=1 or 2 weren't being tested for. I probably wouldn't remember to debug txtSubClass.CustomError for the error()=1 or 2.

I would much rather have a separate class that 1st looked in txtSubClass.CustomError and if the error wasn't handled then look in txtBase.CustomError. That way I don't have to remember to put in dodefault(). I have a hard enough time remembering it in all the other methods (init, show, etc.), but at least in them I can see that something isn't being done when I debug. In an error handler, I wouldn't notice that an error wasn't being checked for.
Bill Morris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform