🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: fj.lang.visualbasic
2 messages
2 total messages Started by Satoshi Sato Wed, 26 Aug 1998 00:00
参照引渡しについて
#148
Author: Satoshi Sato
Date: Wed, 26 Aug 1998 00:00
33 lines
1243 bytes
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
Re: 参照引渡しについて
#149
Author: 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
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads