我有一个'基类',它包含一个'函数',接受'Array of const'类型的参数,如下所示: -
type
TBaseClass = class(TObject)
public
procedure NotifyAll(const AParams: array of const);
end;
procedure TBaseClass.NotifyAll(const AParams: array of const);
begin
// do something
end;
Run Code Online (Sandbox Code Playgroud)
我有另一个'通用类'派生自'基类'(上面定义)
type
TEventMulticaster<T> = class(TBaseClass)
public
procedure Notify(AUser: T); reintroduce;
end;
procedure TEventMulticaster<T>.Notify(AUser: T);
begin
inherited NotifyAll([AUser]); ERROR HERE
end;
Run Code Online (Sandbox Code Playgroud)
每次我编译这段代码时都会出错:
变量类型数组构造函数中的错误参数类型
它指的是什么错?
'Delphi'提供任何方法来'重载''对象'类型的过程,如
TTesting = class(TObject)
Public
Type
TInformationEvent1 = procedure( x: integer ) of object; overload ;
TInformationEvent1 = procedure ( x: integer ; y: string) of object; overload ;
TInformationEvent1 = procedure ( x: integer ; y: string; z: Boolean) of object; overload ;
end
Run Code Online (Sandbox Code Playgroud)
我可以用这三种方式重载这个TInformationEvent1函数吗?