Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclass class in PRG file
Message
De
21/06/2018 13:32:57
 
 
À
21/06/2018 11:03:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01660806
Message ID:
01660812
Vues:
70
J'aime (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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform