Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DoDefault and inheritance
Message
De
21/02/2008 09:27:46
 
 
À
21/02/2008 05:38:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01294645
Message ID:
01294722
Vues:
13
Following proper OOPS techniques, Thomas Ganes suggestion is the correct one. Create a second method in A and override it in B. When the Init calls the method, it will call the local version. If you need the B of the local method to call the parent version, then use DODEFAULT().


>I have a class A whose "Init" method reads
>
>
>Line 1
>Line 2
>.
>.
>.
>Line 10    <-- (my subclass need a diff code for this line)
>.
>.
>.
>DODEFAULT()
>
>
>and B is a subclass of A. For B, in its "Init" method, I want to have everything the same as A's except for Line 10, but I can't figure out a good way to do that...
>
>I was thinking of copy all the codes in Init method of A and place them in Init method of B, then change Line 10 to whatever I want, but there is a problem in the last line -- DODEFAULT(). I can't place this as the last line in B's Init method (obviously, because I don't want to repeat lines in A's Init method), but I need to execute A's parent class Init method codes...
>
>What is the best way to achieve the above, would anyone give me a clue?
>
>Your suggestion will be very much appreciated.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform