🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.lang.visualbasic
Article #149

Re: 参照引渡しについて

#149
From: Yuusuke.Baba
Date: Wed, 26 Aug 1998 00:00
54 lines
1714 bytes
sub test(str as string)
    str = "def"
    debug.print "Func:" ; str
end sub
sub main()
    dim org as string
    org = "abc"
    debug.print "Before:"; org

'    test(org)  <--- ここがおかしい
    test org   <--- これが正解

    debug.print "After:";org
end sub

と書くと上手く行くようです

Satoshi Sato wrote in message <6rukns$2ok$1@news1.din.or.jp>...
>Access97のモジュールで参照渡しをしているつもりですがうまく行きません。
>
>sub test(str as string)
>    str = "def"
>    debug.print "Func:" ; str
>end sub
>sub main()
>    dim org as string
>    org = "abc"
>    debug.print "Before:"; org
>    test(org)
>    debug.print "After:";org
>end sub
>
>こんなプログラムで、デバッグウィンドウを見ると
>
>Before:abc
>Func:def
>After:abc
>
>となります。
>
>Before:abc
>Func:def
>After:def
>
>のような結果を期待しているのですが。
>
>どなたか、教えてください。
>
>Win95+Access97
>
>佐藤:ssatoshi@din.or.jp
>
>
>
Technical Details
Message-ID: <6rvj3p$41q$1@nn-tk002.ocn.ad.jp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6rukns$2ok$1@news1.din.or.jp>

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: 105c2e,b68722831c34558d
X-Google-Attributes: gid105c2e,public
X-Google-Thread: 115e07,b68722831c34558d
X-Google-Attributes: gid115e07,public
From: "Yuusuke.Baba" <baba@newson.co.jp>
Subject: Re: 参照引渡しについて
Date: 1998/08/26
Message-ID: <6rvj3p$41q$1@nn-tk002.ocn.ad.jp>
X-Deja-AN: 384732812
Content-Transfer-Encoding: 7bit
References: <6rukns$2ok$1@news1.din.or.jp>
Content-Type: text/plain; charset="iso-2022-jp"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Organization: NTT Open Computer Network
Mime-Version: 1.0
Newsgroups: fj.lang.visualbasic,japan.comp.lang.visual-basic