Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: HIDDEN a property is unusable
Message
From
22/02/2005 16:54:01
 
 
To
18/02/2005 02:18:45
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00987841
Message ID:
00989440
Views:
31
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform