I
ili
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是程序的片断:
procedure TForm1.FormCreate(Sender: TObject);
var
Reg: TRegistry;
begin
entry:=false;//设定初始值
try
Reg := TRegistry.Create;
try
.......
finally
Reg.CloseKey;
inherited
//这里有什么作用??
end;
finally
Reg.Free;
end;
end;
以下是inherited的help,我查了字典还是看不明白:(还请帮忙解释一下
The reserved word inherited plays a special role in implementing polymorphic behavior. It can occur in method definitions, with or without an identifier after it.
If inherited is followed by a method identifier, it represents a normal method call, except that the search for the method begins with the immediate ancestor of the enclosing method抯 class. For example, when
inherited Create(...);
occurs in the definition of a method, it calls the inherited Create.
When inherited has no identifier after it, it refers to the inherited method with the same name as the enclosing method. In this case, inherited can appear with or without parameters
if no parameters are specified, it passes to the inherited method the same parameters with which the enclosing method was called. For example,
inherited;
occurs frequently in the implementation of constructors. It calls the inherited constructor with the same parameters that were passed to the descendant.
procedure TForm1.FormCreate(Sender: TObject);
var
Reg: TRegistry;
begin
entry:=false;//设定初始值
try
Reg := TRegistry.Create;
try
.......
finally
Reg.CloseKey;
inherited
//这里有什么作用??
end;
finally
Reg.Free;
end;
end;
以下是inherited的help,我查了字典还是看不明白:(还请帮忙解释一下
The reserved word inherited plays a special role in implementing polymorphic behavior. It can occur in method definitions, with or without an identifier after it.
If inherited is followed by a method identifier, it represents a normal method call, except that the search for the method begins with the immediate ancestor of the enclosing method抯 class. For example, when
inherited Create(...);
occurs in the definition of a method, it calls the inherited Create.
When inherited has no identifier after it, it refers to the inherited method with the same name as the enclosing method. In this case, inherited can appear with or without parameters
if no parameters are specified, it passes to the inherited method the same parameters with which the enclosing method was called. For example,
inherited;
occurs frequently in the implementation of constructors. It calls the inherited constructor with the same parameters that were passed to the descendant.