General information
Category:
Object Oriented Programming
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only