Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correlations among VFP and OOP languages
Message
From
11/06/2006 20:02:59
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01128092
Message ID:
01128369
Views:
19
>Thomas,
>
>>True, but you can fake it (sort of...<g>)
>
>That would do it, but at the cost of explicitly requiring no dodefault() call in the the subclass. This is dangerous because it's only true at the first level of subclass . And since you may not know when code at a higher level will be inserted. For example:

I've seen this tamed like this:

>
define class GraphicAbstractObject as custom
   x = 0
   y = 0

function moveTo( newX, newY )
  this.AbstractWarn()
endfunc

function draw()
  this.AbstractWarn()
endfunc

function AbstractWarn()
  if this.class="GraphicAbstractObject"  
    local lcSetAssert
    lcSetAssert = set("Assert")
    set Assert on
*-- and show the caller's name, not the warning's name:
    assert .f. Message Program(program(-1)-1) + " should be overwritten !"
    set Assert &lcSetAssert
  endif

enddefine
The downside of this approach is that the class has to have its abstract level name hardcoded somewhere (either as a property, or in the abstractwarn()).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform