unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
var a, b : TMyObject;
procedure TForm2.Button1Click(Sender: TObject);
begin
MyObject := TMyObject.Create(self);
MyObject.Show;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
a := MyObject.GetMyObject;
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
b := MyObject.GetMyObject;
end;
procedure TForm2.Button4Click(Sender: TObject);
begin
a.FreeMyObject;
a :=
nil;
end;
procedure TForm2.Button5Click(Sender: TObject);
begin
b.FreeMyObject;
b :=
nil;
end;
procedure TForm2.Button6Click(Sender: TObject);
begin
MyObject.FreeMyObject;
MyObject :=
nil
end;
procedure TForm2.Button7Click(Sender: TObject);
begin
Close;
end;
end.