31-08-2013, 07:13 PM
يجدر الذكر أن ال Object تستخدم التمرير بالمرجع (لا وجود للتمرير بالقيمة)
PHP كود :
type
TMyObj = class
private
FMyPropertyStr: string;
FMyPropertyInt: Integer;
property MyPropertyStr: string read FMyPropertyStr write FMyPropertyStr;
property MyPropertyInt: Integer read FMyPropertyInt write FMyPropertyInt;
end;
//---------------------------------------------
procedure DoSomething(m: TMyObj);
begin
m.MyPropertyStr := 'Test';
m.MyPropertyInt := 20;
end;
procedure TForm3.Button1Click(Sender: TObject);
var
MyObj: TMyObj;
begin
MyObj := TMyObj.Create;
MyObj.MyPropertyInt := 10;
MyObj.MyPropertyStr := 'Hi';
DoSomething(MyObj);
Caption := MyObj.MyPropertyStr + ' -- ' + IntToStr(MyObj.MyPropertyInt);
MyObj.Free;
end;
Open Your Source .. Open Your Mind

