Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running both the class method code and the userdefined
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00041688
Message ID:
00041819
Views:
36
Barbara,

Yes, I saw Jim B's after I wrote.

Classing it twice seems to be the answer. But it was actually some code in MaxFrame which got me thinking originally about this very question. In some cases there you will find the subclass invoking the parent's method inaddition to its own.

Cheers,
Jim N

>Hi, Jim. Arnon seems to be taking the rest of the day off, so I'll give it a try. First, read Jim Booth's message on this thread (7/26/97, 12:59) because he makes the point that when you subclass you need to decide whether you want a grandparent/parent/child subclass or have a second class at the PARENT level.
>Writing code in a method in a sub-class is done for 2 reasons: 1) To REPLACE the parent's code and 2) To ADD to the parent's code. If you are using a class in several places and sometimes want 1) and sometimes 2), CLASS IT TWICE!!
>
>Another idea is one I picked up from Visual MaxFrame: Add a method called "ShellAdditionalMethod" for any method. Put a call to this method in your PARENT (top level) class. If it's blank, nothing happens, but if you WANT code that doesn't overwrite the code in the parent class' method it's easy to put it in.
>
>HTH
>Barbara
>
>
>>Arnon,
>>
>>I have always wondered about the following, and this looks like a good time to ask. . .
>>
>>IF I had a class (son - A) subclassed from father B and grandfather C, and each had some Init() code and I wanted to ensure that *each* had its code execute when I invoke A.
>>
>>It seems like a simple DODEFAULT will simply cause B's Init() to execute.
>>1) Is this correct?
>>
>>Assuming it *is* correct, it seems the only way to ensure that C's code also executes is to code a DODEFAULT in B. Which would be fine if one ALWAYS wanted to execute the code in A too.
>>2) But how would one do this if one only wanted to execute C's code sometimes (always B's but only sometimes a's)?
>>3) How would one code to execute ONLY C's code (bypassing B's?
>>
>>This is more for academic knowledge than anything else.
>>
>>regards,
>>Jim N
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform