Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correlations among VFP and OOP languages
Message
From
13/06/2006 03:36:23
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01128092
Message ID:
01128602
Views:
24
Hi DAvid,

>That's a stab at it, but it'll need more tweaking because the function is depth dependent. At a third level of inheritance it doesn't work:

? If I put the code in a program, it works (since the "prg" is the extension at level -2) - as levels with empty methods are not put on the stack. If you working from the command window, there is the chance that "calling levels" are not there, which I meant in my update. But the code should fail miserably when running against polymorphic usages:
ox = createobject( "g3b" )
op = createobject( "gpolymorph" )
op.draw()

define class gpolymorph as Custom
  function draw()
     *-- calling from here (existance of the callee assumed)
     *-- breaks the assert check, since the polymorphic method does not
     *-- implement a method of the abstract class.
     ox.draw()
enddefine

define class G3b as G2b
enddefine
Implementing the check at compile time sounds like a nice approach, since also checking against the above problem might give you a hefty runtime penalty if done often/always. But I suppose such a builder might encounter some difficulties as well: first bump i visualze would be differing factory patterns from class loading via table down to makro expansion... Unless you do a static check on all classes included and even flag methods which are not overwritten but also not called in the current system.

Such an assert for me is more of a wakeup-call to make sure I don't forget implementing a certain feature...

regards

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform