Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DoDefault and inheritance
Message
From
21/02/2008 10:05:14
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01294645
Message ID:
01294746
Views:
21
>>Following proper OOPS techniques, Thomas Ganes suggestion is the correct one. Create a second method in A and override it in B. When the Init calls the method, it will call the local version. If you need the B of the local method to call the parent version, then use DODEFAULT().
>>
>>
>Thomas and Marcia suggested this technique. We're also using hook methods.
>
>So, line 10 will become a separate method in the Base class and the derived class would only need to overwrite one method. Hopefully line 10 can be easily created as a separate method.
>
>Otherwise I would use Borislav's idea of invoking this line conditionally based on some property.
>
>In either case, this assumes that we would need to change class A.

In line with this thread, if using a conditional method, then the sub-classing to class B is unnecessary. Calling a second method and overriding it in subclasses allows for more granular coding. By rule, each method has one duty to do. Parent method defines the order and procedure they are called. Then, in the future, if a request is made for a third version of the class, only the second method is updated, and the parent class is never touched. The other sub-classes of A are at low risk of becoming buggy.

(Recently I have studying methods of refactoring code).
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform