帮帮我吧
编译时有错误,我该怎么改unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
type
Thuman =class
private
name:string;
public
procedure Draw;
procedure SetName(c:String);
function GetName:String;
end;
procedure Thuman.Draw;
begin
Form1.ListBox1.Items.Add('师生信息');
end;
procedure Thuman.SetName(c:String);
begin
name:=c;
end;
function Thuman.GetName:string;
begin
result:=name;
end;
type
Tstudent=class(Thuman)
private
age:integer;
school:string;
public
procedure Draw;
end;
procedure Tstudent.Draw;
var
mystr:String;
school:string;
begin
mystr:='学生姓名是'+name+',年龄为'+IntToStr(age)+',学校为'
+school;
Form1.ListBox1.Items.Add(mystr);
end;
type
Tteacher=class(Thuman)
private
age:integer;
gz:integer;
public
procedure Draw;
end;
procedure Tteacher.Draw;
var
mystr:String;
begin
mystr:='教师姓名是'+name+',年龄为'+IntToStr(age)+',月工资为'
+IntToStr(gz);
Form1.ListBox1.Items.Add(mystr);
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s1:Tstudent;
t2:Tteacher;
begin
s1:=Tstudent.Create;
t2:=Tteacher.Create;
s1.age:=20;
s1.SetName('victor');
s1:=Tstudent.school('changjiang');
Form1.ListBox1.Items.Add('学生信息如下:');
//Form1.ListBox1.Items.Add('学生信息如下:');+s1.GetName+s1.School+IntToStr(s1.age));
s1.Draw;
t2.SetName('xiao hong');
t2.age:=30;
t2.gz:=1500;
Form1.ListBox1.Items.Add('教师信息如下:');
t2.Draw;
s1.Destroy;
t2.Destroy;
end;
end.