unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TAdresse =
class(TPersistent)
private
FVorname:
string;
FName:
string;
public
procedure Assign(Source: TPersistent);
override;
property Vorname:
string read FVorname
write FVorname;
property Name:
string read FName
write FName;
end;
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
function GetDebitorName:
string;
function GetReAdr: TAdresse;
protected
Adresse: TAdresse;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.GetReAdr: TAdresse;
begin
Adresse.Vorname := '
a';
Adresse.
Name := '
b';
Result := Adresse;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Adresse := TAdresse.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Adresse.Free;
end;
function TForm1.GetDebitorName:
string;
begin
Result := GetReAdr.Vorname + '
' + GetReAdr.
Name;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
caption := GetDebitorName;
end;
procedure TAdresse.Assign(Source: TPersistent);
begin
if Source
is TAdresse
then
begin
Vorname := (Source
as TAdresse).Vorname;
Name := (Source
as TAdresse).
Name;
end
else
inherited;
end;
end.