Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
De
28/08/2007 06:57:38
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
27/08/2007 20:42:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01250681
Message ID:
01250860
Vues:
16
>AFAIK (and that may be even less than you), as long as oxServer is visible to oxHandler you should be able to reference any method or property.

I mean no offense, but this is the crux of the misunderstanding. Objects are not supposed to know *anything* about the innards of each other. I'm always trying to find examples in the real world to demonstrate the problem ... if a sparkplug could access the inside of the gas tank, BOOM and you're dead!

OOP is OBJECT oriented. Think of it all like you're working with real objects.



Maybe I'm misunderstanding the problem. Do you want something like
>*** Test.prg
>o1 = CREATEOBJECT('abc')
>o2 = CREATEOBJECT('xyz',o1)
>?o1.doit() ------> my state
>DEFINE CLASS abc as Custom
>   FUNCTION doit
>     RETURN o2.sock.state
>   ENDFUNC
>ENDDEFINE
>
>DEFINE CLASS xyz AS Custom
>   prop1 = .null.
>   sock = .null.
>
>   FUNCTION init
>      LPARAMETERS pp
>      This.prop1 = pp
>      This.sock = CREATEOBJECT('sock')
>   ENDFUNC
>ENDDEFINE
>
>DEFINE CLASS sock AS Custom
>   state="my state"
>ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform