home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: CLASSESS }
-
- interface
-
- uses
- WinTypes, WinProcs, Classes,
- Graphics, Controls, Forms, StdCtrls;
-
- type
-
- TMyClass1 = Class(TObject)
- procedure Foo; virtual;
- end;
-
- TMyClass2 = Class(TMyClass1)
- procedure Foo; virtual;
- end;
-
- TForm1 = class(TForm)
- Button1: TButton;
- ListBox1: TListBox;
- procedure Button1Click(Sender: TObject);
- private
- Class1: TMyClass1;
- Class2: TMyClass2;
- end;
-
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TMyClass1.Foo;
- begin
- Form1.ListBox1.Items.Add('Class1');
- end;
-
- procedure TMyClass2.Foo;
- begin
- Form1.ListBox1.Items.Add('Class2');
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- Class1 := TMyClass1.Create;
- Class1.Foo;
- Class1.Destroy;
- Class2 := TMyClass2.Create;
- Class2.Foo;
- Class1 := Class2;
- Class1.Foo;
- Class2.Destroy;
- end;
-
- end.
-