Y
yanyandt2
Unregistered / Unconfirmed
GUEST, unregistred user!
看看 delphi的帮助:
different parameter signature from its ancestor, it overloads the inherited method without hiding it. Calling the method in a descendant class activates whichever implementation matches the parameters in the call.
If you overload a virtual method, use the reintroduce directive when you redeclare it in descendant classes. For example,
type
T1 = class(TObject)
procedure Test(I: Integer)
overload
virtual;
end;
T2 = class(T1)
procedure Test(S: string)
reintroduce
overload;
end;
...
SomeObject := T2.Create;
SomeObject.Test('Hello!')
// calls T2.Test
SomeObject.Test(7)
// calls T1.Test
Within a class, you cannot publish multiple overloaded methods with the same name. Maintenance of runtime type information requires a unique name for each published member.
type
TSomeClass = class
published
function Func(P: Integer): Integer;
function Func(P: Boolean): Integer // error
different parameter signature from its ancestor, it overloads the inherited method without hiding it. Calling the method in a descendant class activates whichever implementation matches the parameters in the call.
If you overload a virtual method, use the reintroduce directive when you redeclare it in descendant classes. For example,
type
T1 = class(TObject)
procedure Test(I: Integer)
overload
virtual;
end;
T2 = class(T1)
procedure Test(S: string)
reintroduce
overload;
end;
...
SomeObject := T2.Create;
SomeObject.Test('Hello!')
// calls T2.Test
SomeObject.Test(7)
// calls T1.Test
Within a class, you cannot publish multiple overloaded methods with the same name. Maintenance of runtime type information requires a unique name for each published member.
type
TSomeClass = class
published
function Func(P: Integer): Integer;
function Func(P: Boolean): Integer // error