Registriert seit: 2. Jul 2005
Ort: Coesfeld
246 Beiträge
Delphi 2005 Personal
|
Re: Unterschied Pointer/Referenzvariablen
1. Mär 2006, 22:30
genau:
Delphi-Quellcode:
procedure Test1(AObj: TObject);
begin
AObj := TObject.Create;
end;
procedure Test2(var AObj: TObject);
begin
AObj := TObject.Create;
end;
var O1, O2: TObject;
begin
O1 := TObject.Create;
O2 := O1;
Test1(O1);
// hier ist O1 = 02:
if O1 = O2 then
ShowMessage('Hah ;D ');
O1 := TObject.Create;
O2 := O1;
Test2(O1);
//hier ist O1 <> O2
if O1 <> O2 then
ShowMessage('Hah ;D ');
end;
See my shadow changing, stretching up and over me.
Soften this old armor. Hoping I can clear the way
By stepping through my shadow, coming out the other side.
Step into the shadow. Forty six and two are just ahead of me.
|