Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DoDefault and inheritance
Message
De
21/02/2008 05:44:01
 
 
À
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:
01294647
Vues:
23
>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...

If you copy everything in subclass level then you simply do not put
dodefault()
You already brought it up manually in upper level so no need calling it again. If there is code 'below' A level that was actually called by that DoDefault() then bring that upward as well.

Update2Update:
Forget below (you are talking about INIT!)
What is below could apply have you been talking about events that have crucial default behaviour and/or receive parameters (keypress,valid etc)
For init mothod, think simple (See Boris response)
--------------------------------------------------------------
If dodefault() of A is to enforce native VFP behaviour rather then deeper class code (parent to A), then you might need to add parameter statement below (in A), pass it by dodefault(SomeFlag) from upper level (B) and then handle it 'downstairs' to fire dodefault() (native behaviour) on the begin of proc and then return immediately without executing the rest.
---------------------------------------------------------------
Or rethink design ;)

HTH
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform