I'm trying to create a class that only contains code, functions and
procedures. I'm doing so to be able to call this functions or procedures
from anywhere within my program.
The code for this class is not object related, basically it's a group of
mathematical functions and procedures.
How does one transforms a PRG into a class?
When you have a PRG containing something like
Function x()
&& code
EndFunc
Function y()
&& code
Endfunc
, you can simply add a Define Class / Enddefine statement as the first
and last line of the file:
Define Class myFunctions As Custom && or Session, whatever
Function x()
&& code
EndFunc
Function y()
&& code
Endfunc
EndDefine
In your calling method you can use NewObject for example:
LOCAL loClass
loClass = NEWOBJECT('myFunctions','progs\myLibs.prg')
? loClass.x()
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
If functions call each other, eg y() calls x(), you need
to change the call of x() to this.x() within the class methods.
Bye, Olaf.
But here's a very simple example:
PUBLIC myObj
myObj = CREATEOBJECT("myobject")
myObj.sayhi
DEFINE CLASS myobject AS CUSTOM
PROCEDURE sayhi
WAIT WINDOW "Hi there"
ENDDEFINE
"CNT LM" <serv...@contor.pt> wrote in message
news:467f2e33$0$28010$a729...@news.telepac.pt...