D
dreamblue
Unregistered / Unconfirmed
GUEST, unregistred user!
我在公共单元的类里申明函数
unit uPublic;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, DBTables, StdCtrls,
DBCtrls, DB, CodeInput,dbGrids,ComCtrls,Grids,ComObj,ADODB,Registry;
type
TPublic= class (Tobject)
protected
public
class procedure write;
end ;
implementation
class procedure tpublic.write;
begin
showmessage('ok');
end;
end.
然后在程序单元里调用write过程uses uPublic;
procedure TForm1.Button1Click(Sender: TObject);
begin
write;
end;
但程序也不提示错误也不显示OK呀?这是为什么呀?
第二,我如果不用CLASS类方法,只在类里申明的话?
unit uPublic;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, DBTables, StdCtrls,
DBCtrls, DB, CodeInput,dbGrids,ComCtrls,Grids,ComObj,ADODB,Registry;
type
TPublic= class (Tobject)
protected
public
procedure write;
end ;
implementation
procedure write;
begin
showmessage('ok');
end;
end.
我在程序里如何调用这个函数呢?请就此给出代码
unit uPublic;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, DBTables, StdCtrls,
DBCtrls, DB, CodeInput,dbGrids,ComCtrls,Grids,ComObj,ADODB,Registry;
type
TPublic= class (Tobject)
protected
public
class procedure write;
end ;
implementation
class procedure tpublic.write;
begin
showmessage('ok');
end;
end.
然后在程序单元里调用write过程uses uPublic;
procedure TForm1.Button1Click(Sender: TObject);
begin
write;
end;
但程序也不提示错误也不显示OK呀?这是为什么呀?
第二,我如果不用CLASS类方法,只在类里申明的话?
unit uPublic;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, DBTables, StdCtrls,
DBCtrls, DB, CodeInput,dbGrids,ComCtrls,Grids,ComObj,ADODB,Registry;
type
TPublic= class (Tobject)
protected
public
procedure write;
end ;
implementation
procedure write;
begin
showmessage('ok');
end;
end.
我在程序里如何调用这个函数呢?请就此给出代码