不
不懂大师
Unregistered / Unconfirmed
GUEST, unregistred user!
TBBB = class
private
...
protected
...
procedure ClearChain;virtual
abstract;
public
...
destructor Destroy;
end;
TAAA = class(TBBB)
private
...
protected
...
procedure ClearChain;
public
...
destructor Destroy;
end;
procedure TAAA.ClearChain;
begin
...
end;
destructor TAAA.Destroy;
begin
ClearChain;
inherited;
end;
=============================================
调用代码:
var
s:TAAA;
begin
s :=TAAA.Create ;
s.Free
//用Free,TAAA.ClearChain不会执行到
// s.Destroy
//用Destroy,TAAA.ClearChain到是会执行
为什么?
private
...
protected
...
procedure ClearChain;virtual
abstract;
public
...
destructor Destroy;
end;
TAAA = class(TBBB)
private
...
protected
...
procedure ClearChain;
public
...
destructor Destroy;
end;
procedure TAAA.ClearChain;
begin
...
end;
destructor TAAA.Destroy;
begin
ClearChain;
inherited;
end;
=============================================
调用代码:
var
s:TAAA;
begin
s :=TAAA.Create ;
s.Free
//用Free,TAAA.ClearChain不会执行到
// s.Destroy
//用Destroy,TAAA.ClearChain到是会执行
为什么?