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