帮我看一下程序,并帮忙解释一下错误提示(100分)

L

loutian

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit162;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,uboolean;
type
tconvert=class(tboolean)
public
class function anystringtoboolean(const value:string):boolean;
end;
type

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }

{ Public declarations }
end;
var
Form1: TForm1;

implementation

class function tconvert.anystringtoboolean(const value:string):boolean;
begin
result:=(length(value)>0 and(value[1] in ['T','Y','y','t']));
end;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
messagedlg(tconvert.anystringtoboolean(edit1.text),mtinformation,[mbok],0);
end;

end.




unit uboolean;

interface
uses
sysutils;
type
tboolean=class
public
class function booleantostring(const value:boolean):string;
class function stringtoboolean(const value:string):boolean;
class function booleantoyesno(const value:boolean):string;
class function yesnotoboolean(const value:string):boolean;
end;
implementation
class function booleantostring(const value:boolean):string;
const
bools:array [boolean] of string=('false','true');
begin
result:=bools[value];
end;
class function booleantoyesno(const value:boolean):string;
const
yes_no:array[boolean] of string=('no','yes');
begin
result:=yes_no[value];
end;
class function stringtoboolean(const value:string):boolean;
begin
result:=comparetext(value,'true')=0;
end;
class function yesnotoboolean(const value:string):boolean;
begin
result:=comparetext(value,'yes')=0;
end;
end.

每次运行时,系统提示以下错误
[Error] uboolean.pas(9): Unsatisfied forward or external declaration: 'tboolean.booleantostring'
[Error] uboolean.pas(10): Unsatisfied forward or external declaration: 'tboolean.stringtoboolean'
[Error] uboolean.pas(11): Unsatisfied forward or external declaration: 'tboolean.booleantoyesno'
[Error] uboolean.pas(12): Unsatisfied forward or external declaration: 'tboolean.yesnotoboolean'
[Fatal Error] Unit162.pas(7): Could not compile used unit 'uboolean.pas'

我实在查不出哪里有问题,是不是程序有问题,请提示,谢谢
 
class ?static方法?
 
是创建无数据类
 
明白着的错误,改成下面这样:
class function tboolean.booleantostring(const value:boolean):string;
const
bools:array [boolean] of string=('false','true');
begin
result:=bools[value];
end;
class function tboolean.booleantoyesno(const value:boolean):string;
const
yes_no:array[boolean] of string=('no','yes');
begin
result:=yes_no[value];
end;
class function tboolean.stringtoboolean(const value:string):boolean;
begin
result:=comparetext(value,'true')=0;
end;
class function tboolean.yesnotoboolean(const value:string):boolean;
begin
result:=comparetext(value,'yes')=0;
end;
end.
 
什么意思你给的程序源码,跟我的一样吗,我不太明白你的意思,你能讲的详细一些吗,谢了
 
多人接受答案了。
 
顶部