Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delphi 中的物件如何共享同一個記憶體位址的變數?

0 views
Skip to first unread message

gschang

unread,
Sep 4, 1998, 3:00:00 AM9/4/98
to
※ 引述《adj...@bbs.yzu.edu.tw (Best boy)》之銘言:
: 請問 Delphi 中的物件如何共享同一個記憶體位址的變數?
: 我的意思是,當一個物件的某變數更改時,
: 其它物件中的那個變數也同時被更新(因為同一個記憶體位址的緣故)!
: 請問要如何在元件中宣告此變數呢?
: 煩請知道的人順便回一封到我的信箱,謝謝!

var
p: pointer; //or p: ^some variable type; p must be a global variable.
...
begin
...
p:= @A; //A is the variable u want to exchange (with B).
...
B:=p^; //B will now get the same address with B (or use @B:=p;)
...
end;
// Another way is just that uses the same "global" variable arround whole
// your program, or use
// procedure(var A: SomeType); to make the variable A called by reference
// , namely, called by memory address. ^_^
--
[1m※Origin: [1;33;44m§國立成功大學電機系BBS§ [m <bbs.ee.ncku.edu.tw> From:[ [1m140.116.22.15 [m]


0 new messages