Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Inheritance Use Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inheritance Use Question

    Using Direct Interface Block definitions with Classes, and am running into an error when utilizing a "UserWritten" Inherit statement in a Direct Interface Block.

    The Error, a "CLASS Expected" error associated with the use of an Inherit Statement in a Direct Interface Block, does not occur when the Direct Interface Block is excluded. (Though the same "UserWritten" Inherit Statement is still included in the derived Class implementation code.)

    Example Code:
    Code:
       INTERFACE CLASS1Interface
          INHERIT IUNKNOWN
    
          Method aRoutine() as Long
    
       END INTERFACE
    
    CLASS CLASS1
       INTERFACE CLASS1Interface
          INHERIT IUNKNOWN
    
          Method aRoutine() as Long
          End Method
    
       END INTERFACE
    END CLASS
    
    'Code compiles as shown with the Direct
    'Interface Block below commented out.  However, 
    'if conditional Direct Interface Block 
    'below is included in the compile,
    'changing #if(0) to #if(1), then the
    'compiler complains...
    ' "CLASS Expected"
    ' Compiler complains about the 
    ' inheritance ONLY with the 
    ' Direct Interface Block below active.
    '--
    
    #if(0)  
       INTERFACE CLASS2Interface
          INHERIT CLASS1, CLASS1Interface  '<-Not Happy
    
          Method aTest() as Long
    
       END INTERFACE
    #endif
    
    
    CLASS CLASS2
       INTERFACE CLASS2Interface
          INHERIT CLASS1, CLASS1Interface   '<- Happy
          
          Method aTest() as Long
          End Method
    
       END INTERFACE
    END CLASS
    
    
    function pbmain()
       waitkey$
    end Function
    It other words, it (the compiler) is happy with "INHERIT CLASS1, CLASS1Interface" as implementation code but not as definition code that is part of a Direct Interface Block. Any insights as to why the Inherit Statement "INHERIT CLASS1, CLASS1Interface" compiles happily until a Direct Interface Block definition is included?
Working...
X