Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HIDING the INIT method in VFP6
Message
From
19/01/1999 15:20:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
HIDING the INIT method in VFP6
Miscellaneous
Thread ID:
00177751
Message ID:
00177751
Views:
73
I recently attempted to Hide the Init method of a class to prevent it from being overridden. I wished to add a method that would be called from the Init method and would be overridable. I decided to verify that VFP6 would behave as expected.

I first created a class cstSuper as Custom with one method: InitChild() which I left empty. I overrode Init with:
?"Superclass Init."
This.InitChild()
and marked the Init method as Hidden.

Next I created a class cstChild as cstSuper and overrode the InitChild method with ?"Augmented.".

When I instantiated an instance of cstChild I expected to see:
SuperClass Init.
Augmented.

Instead I saw:
Augmented.

Then I changed InitChild to:
DODEFAULT()
?"Augmented."

and I saw:
SuperClass Init.
Augmented.

Now for the really strange part. I went back to cstSuper and changed the Init method to Public. When I opened cstChild and edited the Init method of cstChild I saw:
DODEFAULT()
?"Augmented."
which is the code from InitChild. I changed InitChild to ZInitChild and reran the tests with the same results. The only relationship between the methods that I can see, besides the fact that one calls the other is that the user defined method(InitChild, ZInitChild) comes first followed by the Init method in the method list seen in the code editor.

Can anyone else duplicate this behavior?. I am using VFP6 from the initial version of DevStudio 6. I could not reproduce this behavior in VFP5.

Ned.
Ned

Reality is.
Reply
Map
View

Click here to load this message in the networking platform