Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DODEFAULT with parameters
Message
From
07/08/2001 13:46:28
 
 
To
07/08/2001 10:28:07
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00538014
Message ID:
00540822
Views:
17
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform