This function and the operator composed of two colons (called the "Scope Resolution" operator by the docs) let you call methods higher up in the class hierarchy. You use them most often when you want to augment a method to do everything the parent class's method does, plus some more.
uReturn = DoDefault( [ uParmList ] )
uReturn = ClassName::Method( [ uParmList ] )|
Parameter |
Value |
Meaning |
|
uParmList |
List of expressions |
Parameters to pass to the method being called. |
|
ClassName |
Name |
The name of the class whose method you want to call. |
|
Method |
Name |
The name of the method to be called. |
|
uReturn |
The value returned by the method called. |
DODEFAULT(), added in VFP 5, calls directly up the class hierarchy. That is, it can call only the parent class's version of the method you're in. The :: operator gives you more flexibility than that, but most often, you use it the same way. You can, in fact, call any method that's in the class's inheritance tree. You can't call a method that belongs to a class the current class doesn't inherit from.
Despite the fact that :: is more flexible, it's better to use DODEFAULT() when you can because it doesn't tie your code to a particular class or method name. Your code is more reusable if you allow the DODEFAULT() to find the appropriate class hierarchy for the method it finds itself in.
DEFINE CLASS CloseButton AS CommandButton
* Set appropriate properties up here
* including
Caption = "Close"
PROCEDURE Click
ThisForm.Release
ENDPROC
ENDDEFINE
DEFINE CLASS ConfirmCloseButton AS CloseButton
PROCEDURE Click
LOCAL nResult
nResult = MESSAGEBOX("Closing Form",33)
IF nResult = 1 && OK
DoDefault()
* Or, in VFP 3
* CloseButton::Click
ENDIF
ENDPROC
ENDDEFINE