Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper way of coding a class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00592667
Message ID:
00592692
Vues:
12
Hi Costas,

"This" is only applicable for test1 or test2, in other words, for the own object. You can not use this.showstring on some objects heirs. Try it:
Define Test1 as Test
  function fixFunc(aString)
    test::showString('String: '+aString)
  endfunc
Enddefine
I never did that thing outside of a form. But, just try it !!

Claudio

>I have the following sample class/method structure. There is a problem with it and I am trying to find the best way to code it.
>
>Define Test as custom
> function showString(aString)
> ? aString
> endfunc
>Enddefine
>
>Define Test1 as Test
> function fixFunc(aString)
> this.showString('String: '+aString)
> endfunc
>Enddefine
>
>Define Test2 as Test1
> function showString(aString)
> this.fixFunc(aString)
> endfunc
>Enddefine
>
>The problem is when I use showString() in Test2. It calls fixFunc() which then should call my showString() in Test. instead, of course, it calls the one in Test2 and goes into infinite recursion. I can use Test::showString() instead of this.showString() and it would work. But then that means you have to specify the class of any method you are using which defeats a main feature of inheritance.
>
>My question is: How can i make a showString() in Test2 without messing with the code in Test and Test1.
>
>Thanks
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform