Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
De
27/08/2007 20:42:38
 
 
À
27/08/2007 19:40:25
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01250681
Message ID:
01250815
Vues:
11
>>>You want to access properties and functionality of an object which is not related to your other object. Moreover, you want to access this functionality from the object which has this object as a reference. It goes against OOP principles and I really don't see a way around it, though I'm very tired and upset right now, can not think straight. May be Hugo or Rich have a better idea.
>>
>>Well, I gave 2 ideas already <g>
>
>I'm still not getting it. I simply want to know the value in another object. Can I just say "oxServer.oSock.State" from within the oxHandler object? Nadya may be tired, but I'm new to all this oop stuff and just dont' get it.

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. 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