Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
 
 
À
27/08/2007 17:17:05
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:
01250773
Vues:
17
>>>Just had a thought. What about using AddObject (or something like that) in the oxServer that creates the oHandler object, instead of passing it in? Or is that like having two mirrors facing one another?
>>>
>>You mean something like
>>oxHandler = CREATEOBJECT( "EMPS_Handler_Medinotes_Class" )
>>oxServer = CREATEOBJECT( "EMPS_Server_Class",m.Port,oxHandler )
>>oxServer.oxHandler.addproperty('oxServer',this)
>>
>>I don't know if this is "proper" design, but you would wind up with each object having a reference to the other.
>
>No, just have:
>
>oxServer = CREATEOBJECT( "EMPS_Server_Class",m.Port)
>
>Then inside the oxServer definition, have this:
>
>oxHandler = CREATEOBJECT( "EMPS_Handler_Medinotes_Class" )
>
>Wouldn't that create the object oxHandler as a child of oxServer? Same thing I'm doing when I pass it, but now it will have the proper parent relationship because it was created with oxServer instead of before.

No unless you do it like

this.oxHandler = CREATEOBJECT( "EMPS_Handler_Medinotes_Class" )
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform