Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To Class or not to class
Message
De
20/04/2018 17:13:19
 
 
À
14/04/2018 10:53:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01659269
Message ID:
01659567
Vues:
58
>Hi Sandy.
>
>>As c# developers know, we can't write a method/procedure/function in c# outside of a class.
>>But in VFP you can.
>
>Think of a VFP function or procedure as a static method of a class in that you can call it without having to instantiate the class. Sometimes it makes sense to make a method static, other times to require instantiating the class so you get persistent state (that is, the properties of the class).
>
>One big benefit of VFP functions is that they can be called from expressions, such as in reports. e.g. MyFunction(SomeParameter). Class methods can't be called that way unless the class has been instantiated into an object that's visible to the expression evaluation e.g. SomeObject.MyFunction(SomeParameter). That means the report (or whatever has the expression) is more tightly coupled to the calling code, which is never a good thing.
>
>Doug

Good points.
Thanks
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform