Runs a parent class method from within a subclass method.
Syntax
cClassName::cMethod
Remarks
The :: operator is used to execute a parent class method from within a subclass method. When you create a subclass, the subclass methods are automatically inherited from the parent class. The :: operator lets you execute the parent class method in the subclass method and then perform additional processing for the subclass method. The subclass definitions in the example demonstrate how the :: operator is used to execute the parent class method within a subclass method.
For additional information about the :: scope resolution operator, see Chapter 3, Object-Oriented Programming in the Programmer's Guide.
To add to Dave's explanation, it was used more in VFP 3.0, since we didn't have the DODEFAULT() command. Then, if you wanted to add code to a form's INIT(), that was based on a class with code it it's INIT(), you'd write:
* INIT()
** generic, so you don't need to know parent's name
=EVAL(THIS.Class + "::Init()"
WAIT Window "Init" NOWAIT
The scope resolution operator is useful when you know that some parent class overrode behavior in a method in a way that you don't want in your sub-class, but you still want to include inherited behavior from higher up the class hierarchy. With the scope resolution operator, you can call the method from any parent class up the inheritance tree.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.