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;
The last one.
with Object1, Object2 do
is equivalent to
with Object1 do
with Object2 do
and so Object2
will be the number-one priority.
The official documentation on this matter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With