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
Titre:
Proper way of coding a class
Divers
Thread ID:
00592667
Message ID:
00592667
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform