Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
De
28/08/2007 09:44:48
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
28/08/2007 07:30:31
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01250681
Message ID:
01250896
Vues:
14
>>This is simplified, but oSock and oHandler are on the same level under the oxServer class. In oHandler is the Acknoledgement procedure that needs to know the current status of the port, which is in oSock. How do I make that reference? This.Parent doesn't seem to work as the oHandler is created before oxServer.
>>
>>
>>
>>oxServer
>>   oSock
>>      State
>>   oHandler
>>     Acknowledgement procedure (needs to know value of oSock.State)
>>
>
>Objects are not supposed to know anything about the insides of other objects at runtime.
>
>Don't use the init of the objects to do much. Create your own Setup method on oSock and oHandler. Instantiate both oSock and oHandler within oxServer's Init and call their Setup methods. oxServer should have methods to support communication between oSock and oHandler. oxServer should have a method like GetState and GetAcknowledgement. oSock should have a method like GetState and oHandler should have a method like GetAcknowledgement. oHandler.GetState can then do THIS.Parent.GetState().
>
>My telephone handset has a jack for a headset. The jack is like oxServer. It connects the headset to the handset. The blueprints for each contain the details for each AND they show single connection points between each.
>
>Each of these don't know anything about the other except the connection points.

My oHandler does not have a Parent value in it's properties at runtime. I'm creating oHandler in oxServer.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform