L
LeeChange
Unregistered / Unconfirmed
GUEST, unregistred user!
答题,人家不信有通过类调用方法一说,编代码试,结果很晕。
简单代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TA = class
public
class procedure a;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TA }
class procedure TA.a;
begin
ShowMessage(ClassName)
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a: TA;
begin
TA.a
//第一句
a.a
//第二句
end;
end.
第一句和第二句分别出什么结果?
把第一句和第二句的顺序倒一下又是什么结果?
关键一问:why?
btw:至于怎么做才正确的回答就算了,关键是想知道出这种怪异结果的原因。
简单代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TA = class
public
class procedure a;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TA }
class procedure TA.a;
begin
ShowMessage(ClassName)
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a: TA;
begin
TA.a
//第一句
a.a
//第二句
end;
end.
第一句和第二句分别出什么结果?
把第一句和第二句的顺序倒一下又是什么结果?
关键一问:why?
btw:至于怎么做才正确的回答就算了,关键是想知道出这种怪异结果的原因。