Wiki Home

Static Keyword


Namespace: VFP
I understand the use of static with regard to a property in a class. However why would you use it in declaring a function, i.e.

public static void main()
{
}

Is that just good practice (like using Option Explicit in VB) or are there other reasons?

-- Alan Bourke

Static function exist for ease of use. You don't need to instanciate the class to use them so they are good candidate for utility functions.

Keep in mind that a static function cannot use non-static properties or non-static functions. -- SL

Good reading: "Compare Static Members in VFP and .NET", by Claudio Lassala, FoxPro Advisor Sept.2004
( Topic last updated: 2004.09.08 09:53:52 PM )