Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does a double colon "::" mean?

Status
Not open for further replies.

nwmedia

Programmer
Jun 21, 2001
7
US
I have some code that includes the following statement:

Efrm::Init(tcKeyValue, tnAskAdd)

Can anyone explain what this is doing??

I understand the passing of values to the init function but what does the :: mean?

Thanks.
 
From the MSDN:

:: Scope Resolution Operator
Example See Also

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.

Dave S.
 
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

Now:
* INIT()
DODEFAULT()
WAIT Window "Init" NOWAIT

Rick
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top