Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Skipping inheritance
Message
 
To
09/06/2003 18:59:24
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00797802
Message ID:
00798346
Views:
31
>>Bill,
>>
>>> (simplest example: _HyperLinkBase.NavigateTo() has a "...Visible=.T." in it that I don't want to execute), so I have to re-write the entire method in my sub-class (without a Dodefault()), but I don't want to lose whatever is in the FFC's parent class.
>>
>>
>>* MyClass.NavigateTo
>>Thisform.LockScreen = .T.
>>DoDefault()
>>...Visible = .F.
>>Thisform.Lockscreen = .F.
>>
>
>Hi Jim,
>What do I do about the Visible_Assign() method? Now it gets executed twice.

OK, now you are finding out that in fact the class you want to subclass is NOT the _HyperlinkBase. You need to create your own Hyperlink class that may be similar to the one in the FFC but not the same. You may also subclass the _HyperlinkBase class and override the entire NavigateTo method.

My point is simply that if you find you want to bypass a level in the heirarchy then there is a very good probability that there is something wrong in your class design somewhere. The fact that you must klnow the name of the grandparent class to get past the parent shows you that you have to violate encapsulation to accomplish what you are trying to do.

Now is OK to do that? It depends. It causes problems that you will need to deal with during the maintenance phase of the project (that is remembering that you did that to that method of that class). Personally, I would create a new hyperlink class and inherit from the _HyperlinkBase class and override the NavigateTo method completely so it does not inherit from anywhere.
Previous
Reply
Map
View

Click here to load this message in the networking platform