| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 589 人关注过本帖
标题:帮帮我吧
取消只看楼主 加入收藏
zqhvictor
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2009-10-18
结帖率:60%
收藏
已结贴  问题点数:15 回复次数:0 
帮帮我吧
编译时有错误,我该怎么改



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.
2009-10-27 15:07
快速回复:帮帮我吧
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025370 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved