复合词“with”中的名称解析如何工作?声明?
以下代码中测试了 Ready
的哪个实例,为什么?
interface
type
TObject1 = class
...
public
property Ready: boolean read FReady write FReady;
end;
TObject2 = class
...
public
property Ready: boolean read FReady write FReady;
end;
implementation
var
Object1: TObject1;
Object2: TObject2;
...
procedure test;
var
Ready: boolean;
begin
Ready:= true;
with Object1, Object2 do begin
if Ready then ShowMessage('which one?');
end; {with}
end;
Which instance of Ready
gets tested in the following code, and why?
interface
type
TObject1 = class
...
public
property Ready: boolean read FReady write FReady;
end;
TObject2 = class
...
public
property Ready: boolean read FReady write FReady;
end;
implementation
var
Object1: TObject1;
Object2: TObject2;
...
procedure test;
var
Ready: boolean;
begin
Ready:= true;
with Object1, Object2 do begin
if Ready then ShowMessage('which one?');
end; {with}
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后一张。
相当于
,因此
Object2
将是第一优先级。有关此事的官方文档。
The last one.
is equivalent to
and so
Object2
will be the number-one priority.The official documentation on this matter.