Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Static class methods in VFP?
Message
From
16/08/2007 16:58:23
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01248508
Message ID:
01248677
Views:
27
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
Previous
Reply
Map
View

Click here to load this message in the networking platform