General information
Category:
Coding, syntax & commands
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only