Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling a class' parent method from another object's met
Message
De
01/06/1999 01:22:43
 
 
À
31/05/1999 12:30:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00224571
Message ID:
00224795
Vues:
21
>>Not sure exactly how to describe this problem, but let me try. My form class has a method called MarkDeleted(). Originally, the method in the instantiated form did some stuff, then did a DODEFAULT(), then did some more stuff.
>>
>>I'm changing it to have it call a "method in another object" on the form, but it still needs to call the parent MarkDeleted() method. However, where the parent MarkDeleted() really needs to be called is from within the "method in the other object" (since I need to do stuff before and after calling the parent MarkDeleted())
>>
>>Like I said, a little hard to explain, but I hope people get what I mean. How can I do this? I thought about the old scope resolution operator (::), but it doesn't work, which I didn't really think it would (unless I did something wrong).
>>
>>Anyway, the only way I could think of to handle this was to have two calls to the "method in the other object" and a DODEFAULT() in between. It'll work, but not elegant. Any suggestions?
>>
>>TIA,
>>Bonnie
>
>Bonnie... it sounds like you need to factor out the methods in the 'other object' so that you won't need to call the parents method.. since, I don't think you can do this.
>
>BOb
>
>If you have Design Patterns check out the template pattern.

Hi BOb,

Thanks for the reply! I don't have Design Patterns, but I think you're advocating basically what I ended up doing anyway ...
*-- MarkDeleted() method
IF THISFORM.OtherObject.DelMethod('CheckIt')
  DODEFAULT()
  THISFORM.OtherObject.DelMethod('DidIt')
ENDIF
It works fine, and now that I think about it, it's not all that inelegant a solution.

Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform