Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return DoDefault() surprise
Message
De
18/03/2011 13:06:13
 
 
À
18/03/2011 12:59:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01504135
Message ID:
01504139
Vues:
96
>Some of you probably already knew this, but it caught me off guard...
>
>I have a sublass of a base class, and in a method on the subclass I added local code which did some work, and then invoked DoDefault() to active the base class code and then I was attempting to Return (from the subclass) the return value that I got back from the base class default code.
>
>
>Subclass.SomeMethod()
> 
>   Lparameters tcSomeString
> 
>   *Misc code here
> 
>   Return DoDefault(tcSomeString)
>
>
>
>
>Baseclass.SomeMethod()
> 
>   Lparameters tcSomeString
> 
>   *Misc code here
> 
>   Return _tally
>
>
>So, you can see that baseclass was returning an integer (_tally), which I was attempting to return again in the subclass, but instead the subclass was returning .T. ( a bool). I did not know this is what would happen.
>
>Here is the change I had to make for it work correctly.
>
>
>Subclass.SomeMethod()
> 
>   Lparameters tcSomeString
> 
>   Local lnReturn
> 
>   *Misc code here
> 
>   lnReturn = DoDefault(tcSomeString)
> 
>   Return lnReturn
>
parentclassname::SomeMethod()
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform