procedure gg;
begin
Application.MessageBox('马迪 ', '晕死ua', MB_OK + MB_ICONINFORMATION);
end;
procedure Test.gg;begin
Application.MessageBox('我操', '麻痹', MB_OK +
MB_ICONINFORMATION);end;
procedure Test.KK;
begin
gg;
end;我想让TEST.KK调用全局的静态过程 !要怎么写呢
begin
Application.MessageBox('马迪 ', '晕死ua', MB_OK + MB_ICONINFORMATION);
end;
procedure Test.gg;begin
Application.MessageBox('我操', '麻痹', MB_OK +
MB_ICONINFORMATION);end;
procedure Test.KK;
begin
gg;
end;我想让TEST.KK调用全局的静态过程 !要怎么写呢
type
Test2 = class(TObject)
class procedure gg;
end;class procedure Test2.gg;
begin
Application.MessageBox('马迪 ', '晕死ua', MB_OK + MB_ICONINFORMATION);
end;procedure Test.gg;
begin
Application.MessageBox('我操', '麻痹', MB_OK +
MB_ICONINFORMATION)
end;procedure Test.KK;
begin
test2.gg;
end;
应该创造selfunit这样的关键字
type
Test2 = class(TObject)
class procedure gg;
end;
class procedure Test2.gg;
begin
Application.MessageBox('马迪 ', '晕死ua', MB_OK + MB_ICONINFORMATION);
end;
........
Test2.gg; //调用
//如果不想用class过程,也可以给过程起个别名
type
TPGG = procedure();
end;procedure gg;
begin
Application.MessageBox('马迪 ', '晕死ua', MB_OK + MB_ICONINFORMATION);
end;var
pg:TPGG = gg;
procedure TForm1.gg;
begin
Application.MessageBox('我操', '麻痹', MB_OK +
MB_ICONINFORMATION);
end;procedure TForm1.KK;
begin
pg;
end;
// 或者用类似名字空间的方式
unit Unit2;
interface
uses
Forms;
procedure gg();implementation
procedure gg();
begin
Application.MessageBox('sdfdsf','fdsfs'); //;
end;
end.....unit Unit1;
type test = class;
gg;
end;
uses unit_1;
procedure test.gg;
begin
Unit2.gg; // 显示给出Unit2
end;
unit1.gg; // 单元内全局函数
unit1.form1.gg; // 单元内的form1类中的成员函数