Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DODEFAULT with parameters
Message
De
07/08/2001 13:46:28
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
07/08/2001 10:28:07
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00538014
Message ID:
00540822
Vues:
19
>From this example you can see that in order to obtain the correct results, we would have to test for the existance of parameters in the child method before calling the parent with dodefault():

Yes, of course, a parameter is being passed, in the example. I know. It's confusing.

>1. Never use optional parameters in our custom methods

Not necessarily. I don't use PCOUNT() much anymore with OOP. Instead I check the type of the parameter. If the type passed is .F. and I'm expecting something other than a boolean, I use the default value (if the parameter is truly optional). If the expected type is truly boolean, then I make sure the default should be .f.

>2. Always use a do case..endcase when using dodefault()

>3. Always test the count and type of all parameters in every public method before using them AND write some error handling code if they don't match, which could break when dealing with logical parameters.

See #1.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform