Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 8 Empty Class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00793345
Message ID:
00793627
Vues:
20
Hi, Kevin.

>So if I understand this then, the only benefit from using the Empty
>class with SCATTER is the ability to add properties. There is no way
>to add methods?

There's no way to add methods to an Empty object. What you could do though is something like this (working with your sample code):
CLEAR ALL

SELECT 0
USE MyTable

oMyRec = CREATEOBJECT("SomeClass")
SCATTER NAME oMyRec MEMO ADDITIVE

? oMyRec.Caption
? oMyRec.Test()


DEFINE CLASS SomeClass AS Session

  PROCEDURE Test()
    RETURN "It works"
  ENDPROC

ENDDEFINE
Note that "SomeClass" is deriving from the Session baseclass (it could be anything else but Empty), and the SCATTER is making use of its ADDITIVE class (introduced in VFP 8). That way you can "scatter" data to an existent object (which in this case has all the methods that you want).

HTH
Claudio Lassala
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform