Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DoDefault() as a standard
Message
 
 
À
07/04/1998 15:08:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00090237
Message ID:
00090266
Vues:
24
Bob,

I'd say 98% of the time every overridden method outside of your first level baseclasses should have either a ParentClass::Method() or DoDefault() call. For the 2% of the time you are specifically preventing the inherited code, you should go back and ask yourself why... then when you are sure it should be clearly documented in the overridden method why you are avoiding the inherited behavior.

And you are quite right, even though a method is known to be empty all the way up the classtree today doesn't mean that it won't stay that way forever. By having the ParentClass::Method() call in the overridden code guarantees the objects will see the inherited code when it does appear.

Doing ParentClass::Method() to empty inherited methods is not significant in terms of performance. DoDefault() to empty methods causes the VFP BaseClass behavior to fire twice, sometimes that's a problem.

>I have built a framework for a project that I am part of. As others create forms, they often write code in a method without realizing that it's parent has code that will now not run.
>
>There is a list of the methods with code in the framework, but it doesn't always get looked at. Sometimes, code is added to a base method that was previously empty. If one of the already written forms has code in this method, the new base level code will not run in that form.
>
>Question: How reasonable is the solution that ALL code entered into a form or control's method be started with a DoDefault(), even if the parent(s) of this method are currently empty?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform