Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: HIDDEN a property is unusable
Message
De
22/02/2005 19:17:41
 
 
À
22/02/2005 16:54:01
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:
00989477
Vues:
36
>>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.

And the Encapsulation OOP rule, where is it ?
If you accept this behaviour, then you have destroyed the OOP, because:
"if to hide a property into a subClass, then you hide it into the superclass,
you cannot call none superclass's method because you cannot know where this property is used"

>
>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.

Try with Smalltalk, the genesis of OOP.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform