Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclass class in PRG file
Message
From
21/06/2018 13:32:57
 
 
To
21/06/2018 11:03:36
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01660806
Message ID:
01660812
Views:
69
Likes (1)
>At the time of the subclass definition, the upper class must be in scope by a SET PROCEDURE TO MyClass.prg. You must create a new prg (assuming you don't want to change the original one) in which you just redefine what needs to be changed.
>
>For instance, this being MyClass.prg
>
>
>DEFINE CLASS SomeClass AS Custom
>
>  FUNCTION Method_One
>    LPARAMETERS Parm1 AS Number, Parm2 AS Number
>    RETURN m.Parm1 * m.Parm2
>  ENDFUNC
>
>  FUNCTION Method_Two
>    LPARAMETERS Parm1 AS Number, Parm2 AS Number
>    RETURN m.Parm1 / m.Parm2
>  ENDFUNC
>
>END DEFINE
>
>
>you may write a different MySubClass.prg with
>
>
>DEFINE CLASS SomeSubClass AS SomeClass
>
>  FUNCTION Method_Two
>    LPARAMETERS Parm1 AS Number, Parm2 AS Number
>    RETURN IIF(m.Parm2 = 0, .NULL., m.Parm1 / m.Parm2)
>  ENDFUNC
>
>END DEFINE
>
That's not necessary. Use the OF keyword:
DEFINE CLASS SomeSubClass AS SomeClass of MyClass.PRG
Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform