Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: HIDDEN a property is unusable
Message
De
22/02/2005 16:54:01
 
 
À
18/02/2005 02:18:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00987841
Message ID:
00989440
Vues:
33
>The question is: does an inherited method execute in the context of the SubClass or of the SuperClass ?

>I'm tempted to say that it is the former and that there should be no error on the second call() of the example

Well, the example of Fabio shows, that the inherited procedure is running in the context of the Superclass. But the property is (re)defined in the context of the Subclass, so it's quite right, that the SuperClass code execution fails, because the overridden property is hidden in the context of SuperClass, because the property belongs to the SubClass.

I've tried to overcome that by also overriding the call procedure (but not overloading it with the same code, that would break inheritance):
DEFINE CLASS subClass  as SuperClass 
   hiddenproperty = 2   
   HIDDEN hiddenproperty

   PROCEDURE call
      SuperClass::call
   ENDPROC 
ENDDEFINE
But that doesn´t change the context of the call procedure. There seems no way out, but I think that's by design and I wonder if some other language handles this differently.

Bye, Olaf.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform