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:
00592771
Vues:
23
Costas,

The problem is in the understanding of inheritance. Test2 overrides the ShowString method of Test, so when you instantiate test2 the inherited code in FixFunc will be calling the ShowString method of Test2 since Test2 is the object you have instantiated. If you instantiate test1 the ShowString method that will execute is the one in Test because test1 inherits that method and does not override it.

If you want it to behave the way you are describing then you need to use the scope resolution operator in Test1 as in;
Define Test1 as Test
function fixfunc(aString)
  Test::ShowString("String: "+aString)
Endfunc
enddefine
Now the FixFunc method of test1 is calling the showstring method in test explicitly and will not be effected by the fact that Test2 has overridden that method.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform