Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Static class methods in VFP?
Message
De
16/08/2007 16:58:23
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01248508
Message ID:
01248677
Vues:
28
Hi Paul,

Another way to look at it is that static methods are C#'s implementation of UDF's, with added OOP benefits of course, but otherwise you would have to instantiate an object to do anything. IIRC, static classes actually do get instantiated internally. In other words, if you added a constructor to your MyHello class, it would run the first time you called any static method on that class. I don't know what's going on under the hood, but it essentially works like a public object. To get similar behavior, you could instantiate a global object in your startup program that would be available to the entire app, then you could call the methods just like you would on a static class. Personally, I use UDF's for utility type stuff or add methods to our global application object when it makes sense.

>Thanks Craig. That's what I figured.
>
>
>>Hi Paul,
>>
>>User Defined Functions are the closest thing in VFP.
>>
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform