Announcement

Collapse
No announcement yet.

Property returniong type ok, usage not

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

  • Edwin Knoppert
    replied
    A bit of annoying, now i have an object which i may not pass directly.

    In an interface i have a property returning another interface (think of parent) and i can use it with OOP syntax.
    Now i wish to pass this parent object to a function which is declared byref like:

    Function Hello( ByRef oParent As IMyParentInterface ) and get a similar error.
    If i use a variable and pass that it is ok like:

    local oParent As IMyParentInterface
    oParent = IChild.parent
    Hello( oParent )

    That is overhead.

    Leave a comment:


  • Edwin Knoppert
    replied
    Hmm, a bit like peek and poke isn't?
    Oh well, i'll reconsider using a property then.
    (Usually i return it byref)

    Leave a comment:


  • José Roca
    replied
    And it is, but you have to use TYPE SET or LSET to assign it, i.e. TYPE SET R = Me.Size().

    Leave a comment:


  • Edwin Knoppert
    replied
    Get Size suggest it's allowed to return a RECT variable.

    Leave a comment:


  • Steven Pringels 3
    replied
    hI Edwin,

    Looking at your code, the R in the Get Property will not contain any
    values since R is locally defined and not an Instance veriable. Is this
    what you want ?

    Ok, then to the meat of the problem.

    Try Lset R = me.Size()

    Cheers
    Steven

    Leave a comment:


  • Edwin Knoppert
    started a topic Property returniong type ok, usage not

    Property returniong type ok, usage not

    I get this error:

    PowerBASIC for Windows
    PB/Win Version 9.00
    Copyright (c) 1996-2008 PowerBasic Inc.
    Venice, Florida USA
    All Rights Reserved

    Error 426 in ----
    Variable expected
    Line 802: R = Me.Size

    Code:
            Property Get Size() As RECT
                Local R As RECT
                Property = R
            End Property
    
            Method Hello() As Long
                Local R As RECT
                R = Me.Size()
            End Method
Working...
X