views:

65

answers:

0

I am using RapidQ (an obscure environment, I know). The programming language is Basic.

The following source code illustrates the problem:

Type MyType Extends QOBJECT

    aVar as Integer

    Sub SetTheVar
        this.aVar = 10
    End Sub

    Sub DoSomething
        this.Avar = 20
        this.SetTheVar

        SHOWMESSAGE "aVar = " + STR$(this.aVar)
    End Sub

End Type

Sub MySubroutine
    Dim localVar as MyType
    localVar.DoSomething
End Sub

Dim globalVar as MyType

globalVar.DoSomething  //result: aVar = 10
MySubroutine           //result: aVar = 20

The output is as follows:

aVar = 10
aVar = 20

What gives? I would expect aVar to be 10 in both cases.