home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programming Unleashed
/
Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso
/
misc
/
objects
/
classex
/
class1
/
main.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-20
|
1KB
|
63 lines
unit Main;
{ Program copyright (c) 1995 by Charles Calvert }
{ Project Name: CLASS1 }
{ Simple example of playing with class instances. }
interface
uses
WinTypes, WinProcs, Classes,
Graphics, Forms, Controls,
StdCtrls;
type
TMyClass = class(TObject)
end;
TForm1 = class(TForm)
SeeClasses: TButton;
Memo1: TMemo;
procedure SeeClassesClick(Sender: TObject);
private
MyClass: TMyClass;
end;
var
Form1: TForm1;
implementation
uses
SysUtils;
{$R *.DFM}
procedure TForm1.SeeClassesClick(Sender: TObject);
var
AnObject: TObject;
S: String;
begin
Memo1.Lines.Clear;
MyClass := TMyClass.Create;
S := 'Class name: ' + MyClass.ClassName;
Memo1.Lines.Add(S);
S := 'Parent: ' + MyClass.ClassParent.ClassName;
Memo1.Lines.Add(S);
S := 'Instance size: ' + IntToStr(MyClass.InstanceSize);
Memo1.Lines.Add(S);
MyClass.Free;
AnObject := TObject.Create;
S := 'Class name: ' + AnObject.ClassName;
Memo1.Lines.Add(S);
S := 'Instance Size: ' + IntToStr(Anobject.InstanceSize);
if AnObject.ClassParent <> nil then begin
S := AnObject.ClassParent.ClassName;
Memo1.Lines.Add(S);
end;
AnObject.Free;
end;
end.