Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way of coding a class
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00592667
Message ID:
00592690
Views:
16
You should be able to do it with the following changes: You wouldn't even need the Test2 class. hth
Define Test as custom
  function showString(aString)
    ? aString
  endfunc
Enddefine

Define Test1 as Test
  <b>function showString(aString)
    text::showString(this.fixFunc(aString))
  endfunc</b>
  function fixFunc(aString)
    <b>return 'String: ' + aString</b>
  endfunc
Enddefine

<b>Define Test2 as Test1
Enddefine</b>
>
>The problem is when I use showString() in Test2. It calls fixFunc() which then should call my showString() in Test. instead, of course, it calls the one in Test2 and goes into infinite recursion. I can use Test::showString() instead of this.showString() and it would work. But then that means you have to specify the class of any method you are using which defeats a main feature of inheritance.
>
>My question is: How can i make a showString() in Test2 without messing with the code in Test and Test1.
>
>Thanks
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform