Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can call a function from DEFINE class?
Message
From
06/05/2024 11:07:29
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
06/05/2024 06:44:07
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01687987
Message ID:
01687996
Views:
40
Dragan,

Functions and methods are different constructs and - even if they look alike they should be mixed in no way.

A method call with a return value might look like function call, but I like to give you a most simple difference.

A method is part of a object. An object belongs to a datasesssion, and, for that, to all SET and SYS commands that are special for this datasession. Also the cursors open might differ.

A function, on the other hand always to the datasession you call the function from.

Also, it's the idea of objects that an object carries data (properties) and methods that deal with those data. This concept is weakened over time, but one still should remember it.


tl;dr;
You get a return value from a objects method. Do not mix this wording. Also do not mix the meaning.

Lutz

>On top of what's been said here, yes you can call an object's method as a function, we do that a lot. Assume you have a PathHelper class, and then, for example
>
>lcPath=oPathHelper.getAppHomePath()
>
>To have that object accessible, make it a global variable, or, if you also want to reduce the number of global variables, set it as a property of one global object:
>
>oApp.NewObject("oPathHelper", "pathhelper", "helpers.vcx")
>
>lcPath=oApp.oPathHelper.getAppHomePath()
>
>I've seen this done many times, and I did it too.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform